glarea: Use the appropriate texture format for GLES

The core OpenGL ES spec does not have GL_BGRA, so we need to make do
with GL_RGBA and live with the format conversion.
This commit is contained in:
Emmanuele Bassi
2016-04-25 12:28:41 +01:00
parent 971998de34
commit b45c7b508b

View File

@ -458,7 +458,11 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
if (gdk_gl_context_get_use_es (priv->context))
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
else
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
}
if (priv->render_buffer)