Use the right internal format for GL_ARB_texture_rectangle

When ClutterGLXTexturePixmap uses GL_ARB_texture_rectangle,
it needs to pass the right internal format (GL_RGB or GL_RGBA)
when it initializes the texture with glTexImage2D() or later
handling won't recognize the alpha channel.

http://bugzilla.openedhand.com/show_bug.cgi?id=1586

Signed-off-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Owen W. Taylor 2009-05-06 23:35:01 -04:00 committed by Robert Bragg
parent 2c6719502a
commit 5481681e5c

View File

@ -331,7 +331,10 @@ create_cogl_texture (ClutterTexture *texture,
cogl_format = COGL_PIXEL_FORMAT_RGB_888; cogl_format = COGL_PIXEL_FORMAT_RGB_888;
} }
else else
{
g_critical ("Can't create a TFP cogl texture for pixmap with depth < 24"); g_critical ("Can't create a TFP cogl texture for pixmap with depth < 24");
return FALSE;
}
/* We want to use the GL_ARB_texture_rectangle extension on some /* We want to use the GL_ARB_texture_rectangle extension on some
chipsets because GL_ARB_texture_non_power_of_two is not always chipsets because GL_ARB_texture_non_power_of_two is not always
@ -345,7 +348,7 @@ create_cogl_texture (ClutterTexture *texture,
glGenTextures (1, &tex); glGenTextures (1, &tex);
glBindTexture (CGL_TEXTURE_RECTANGLE_ARB, tex); glBindTexture (CGL_TEXTURE_RECTANGLE_ARB, tex);
glTexImage2D (CGL_TEXTURE_RECTANGLE_ARB, 0, glTexImage2D (CGL_TEXTURE_RECTANGLE_ARB, 0,
GL_RGB, width, height, gl_format, width, height,
0, GL_RGB, GL_UNSIGNED_BYTE, NULL); 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
handle = cogl_texture_new_from_foreign (tex, CGL_TEXTURE_RECTANGLE_ARB, handle = cogl_texture_new_from_foreign (tex, CGL_TEXTURE_RECTANGLE_ARB,