[ClutterGLXTexturePixmap] Use an RGB texture (not ARGB) for 24bpp pixmaps
By creating an ARGB texture for 24bpp pixmaps we were exposing an undefined alpha channel to the blending and texture combine stages which resulted in nasty artefacts. (This issue was seen on i945 + DRI2)
This commit is contained in:
parent
ed991fe3c5
commit
f09b221ade
@ -317,8 +317,25 @@ create_cogl_texture (ClutterTexture *texture,
|
||||
{
|
||||
ClutterGLXTexturePixmap *texture_glx = CLUTTER_GLX_TEXTURE_PIXMAP (texture);
|
||||
ClutterGLXTexturePixmapPrivate *priv = texture_glx->priv;
|
||||
CoglHandle handle;
|
||||
gboolean using_rectangle;
|
||||
CoglHandle handle;
|
||||
gboolean using_rectangle;
|
||||
GLint gl_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
guint depth;
|
||||
|
||||
g_object_get (G_OBJECT (texture_glx), "pixmap-depth", &depth, NULL);
|
||||
if (depth == 32)
|
||||
{
|
||||
gl_format = GL_RGBA;
|
||||
cogl_format = COGL_PIXEL_FORMAT_RGBA_8888;
|
||||
}
|
||||
else if (depth == 24)
|
||||
{
|
||||
gl_format = GL_RGB;
|
||||
cogl_format = COGL_PIXEL_FORMAT_RGB_888;
|
||||
}
|
||||
else
|
||||
g_critical ("Can't create a TFP cogl texture for pixmap with depth < 24");
|
||||
|
||||
/* We want to use the GL_ARB_texture_rectangle extension on some
|
||||
chipsets because GL_ARB_texture_non_power_of_two is not always
|
||||
@ -332,21 +349,20 @@ create_cogl_texture (ClutterTexture *texture,
|
||||
glGenTextures (1, &tex);
|
||||
glBindTexture (CGL_TEXTURE_RECTANGLE_ARB, tex);
|
||||
glTexImage2D (CGL_TEXTURE_RECTANGLE_ARB, 0,
|
||||
GL_RGBA, width, height,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GL_RGB, width, height,
|
||||
0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
handle = cogl_texture_new_from_foreign (tex, CGL_TEXTURE_RECTANGLE_ARB,
|
||||
width, height,
|
||||
0, 0,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888
|
||||
| COGL_BGR_BIT);
|
||||
cogl_format | COGL_BGR_BIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
handle
|
||||
= cogl_texture_new_with_size (width, height,
|
||||
-1, FALSE,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888|COGL_BGR_BIT);
|
||||
cogl_format | COGL_BGR_BIT);
|
||||
|
||||
using_rectangle = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user