From b90d824626c7ab22c47d1cb9634c5d311eb1ca9e Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Fri, 15 Nov 2013 18:28:49 +1100 Subject: [838/906] gl: Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE We create our textures (in Desktop GL) with GL_TEXTURE_RECTANGLE, vaapi attempts to bind our texture to GL_TEXTURE_2D which throws a GL_INVALID_OPERATION error and as thus, no video. Also, by moving exclusively to GL_TEXTURE_2D and the npot extension we also remove a difference between the Desktop GL and GLES2 code. https://bugzilla.gnome.org/show_bug.cgi?id=712287 --- tests/check/libs/gstglcontext.c | 12 ++++++------ tests/examples/clutter/cluttershare.c | 8 ++++---- tests/examples/sdl/sdlshare.c | 16 +++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/check/libs/gstglcontext.c b/tests/check/libs/gstglcontext.c index d5c5a8ecf..bb2d2d246 100644 --- a/tests/check/libs/gstglcontext.c +++ b/tests/check/libs/gstglcontext.c @@ -156,10 +156,10 @@ draw_render (gpointer data) -1.0f, -1.0f, 1.0f, -1.0f }; - GLfloat texcoords[8] = { 320.0f, 0.0f, + GLfloat texcoords[8] = { 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 240.0f, - 320.0f, 240.0f + 0.0f, 1.0f, + 1.0f, 1.0f }; gl->Viewport (0, 0, 320, 240); @@ -169,8 +169,8 @@ draw_render (gpointer data) gl->MatrixMode (GL_PROJECTION); gl->LoadIdentity (); - gl->Enable (GL_TEXTURE_RECTANGLE_ARB); - gl->BindTexture (GL_TEXTURE_RECTANGLE_ARB, tex); + gl->Enable (GL_TEXTURE_2D); + gl->BindTexture (GL_TEXTURE_2D, tex); gl->EnableClientState (GL_VERTEX_ARRAY); gl->EnableClientState (GL_TEXTURE_COORD_ARRAY); @@ -182,7 +182,7 @@ draw_render (gpointer data) gl->DisableClientState (GL_VERTEX_ARRAY); gl->DisableClientState (GL_TEXTURE_COORD_ARRAY); - gl->Disable (GL_TEXTURE_RECTANGLE_ARB); + gl->Disable (GL_TEXTURE_2D); #endif #if GST_GL_HAVE_GLES2 const GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f, diff --git a/tests/examples/clutter/cluttershare.c b/tests/examples/clutter/cluttershare.c index ac13b1caa..9e2719bf0 100644 --- a/tests/examples/clutter/cluttershare.c +++ b/tests/examples/clutter/cluttershare.c @@ -137,14 +137,14 @@ update_texture_actor (gpointer data) tex_id = *(guint *) frame.data[0]; /* Create a cogl texture from the gst gl texture */ - glEnable (GL_TEXTURE_RECTANGLE_ARB); - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, tex_id); + glEnable (GL_TEXTURE_2D); + glBindTexture (GL_TEXTURE_2D, tex_id); if (glGetError () != GL_NO_ERROR) g_debug ("failed to bind texture that comes from gst-gl\n"); cogl_texture = cogl_texture_new_from_foreign (tex_id, - GL_TEXTURE_RECTANGLE_ARB, v_meta->width, v_meta->height, 0, 0, + GL_TEXTURE_2D, v_meta->width, v_meta->height, 0, 0, COGL_PIXEL_FORMAT_RGBA_8888); - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); + glBindTexture (GL_TEXTURE_2D, 0); gst_video_frame_unmap (&frame); diff --git a/tests/examples/sdl/sdlshare.c b/tests/examples/sdl/sdlshare.c index 871a90b2e..eb30fdaaf 100644 --- a/tests/examples/sdl/sdlshare.c +++ b/tests/examples/sdl/sdlshare.c @@ -100,14 +100,12 @@ DrawGLScene (GstGLBuffer * gst_gl_buf) glVertex3f (-1.0f, -1.0f, 0.0f); // Bottom Left glEnd (); // we're done with the polygon (smooth color interpolation) - glEnable (GL_TEXTURE_RECTANGLE_ARB); - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture); - glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); + glEnable (GL_TEXTURE_2D); + glBindTexture (GL_TEXTURE_2D, texture); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glLoadIdentity (); // make sure we're no longer rotated. @@ -127,7 +125,7 @@ DrawGLScene (GstGLBuffer * gst_gl_buf) glVertex3f (-1.0f, -1.0f, 0.0f); // Bottom Left glEnd (); // done with the polygon - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); + glBindTexture (GL_TEXTURE_2D, 0); rtri += 1.0f; // Increase The Rotation Variable For The Triangle rquad -= 1.0f; // Decrease The Rotation Variable For The Quad -- cgit v1.2.1