[gtk+] Fix core context creation in GdkGLContext
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix core context creation in GdkGLContext
- Date: Wed, 28 Jan 2015 12:01:08 +0000 (UTC)
commit 27cf0fa34c3a51ddb50391f21aaf2e3984d6dddb
Author: Niels Nesse <nnesse sonic net>
Date: Wed Jan 14 17:30:28 2015 -0800
Fix core context creation in GdkGLContext
- Specifically request GL version when creating context. Just specifying core
profile bit results in the requested version defaulting to 1.0 which causes
the core profile bit to be ignored and an arbitrary compatability context to be
returned.
- Fix GL painting by removing GL calls that have been depricated by the 3.2 core
profile.
- Additionally remove glInvalidateFramebuffer() call, it is not supported by 3.2
core.
https://bugzilla.gnome.org/show_bug.cgi?id=742953
gdk/gdkgl.c | 16 +++++-----------
gdk/gdkglcontext.c | 2 +-
gdk/gdkwindow.c | 1 -
gdk/x11/gdkglcontext-x11.c | 2 ++
gtk/gtkglarea.c | 2 --
5 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index 9cea524..5dae9f6 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -235,8 +235,8 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
glActiveTexture (GL_TEXTURE0);
glUniform1i(program->map_location, 0); /* Use texture unit 0 */
- glEnableVertexAttribArray (0);
- glEnableVertexAttribArray (1);
+ glEnableVertexAttribArray (program->position_location);
+ glEnableVertexAttribArray (program->uv_location);
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
glVertexAttribPointer (program->position_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL);
@@ -272,8 +272,8 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
g_free (vertex_buffer_data);
- glDisableVertexAttribArray (0);
- glDisableVertexAttribArray (1);
+ glDisableVertexAttribArray (program->position_location);
+ glDisableVertexAttribArray (program->uv_location);
}
/* x,y,width,height describes a rectangle in the gl render buffer
@@ -519,7 +519,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable (GL_SCISSOR_TEST);
- glEnable (GL_TEXTURE_2D);
gdk_window_get_unscaled_size (impl_window, NULL, &unscaled_window_height);
@@ -587,8 +586,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
if (alpha_size != 0)
glDisable (GL_BLEND);
- glDisable (GL_TEXTURE_2D);
-
#undef FLIP_Y
}
@@ -644,6 +641,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
if (clip_region)
cairo_region_destroy (clip_region);
+
}
/* This is always called with the paint context current */
@@ -664,7 +662,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
float umax, vmax;
gboolean use_texture_rectangle;
guint target;
-
paint_context = gdk_gl_context_get_current ();
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_SURFACE) == 0 &&
paint_context &&
@@ -692,7 +689,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
target = GL_TEXTURE_2D;
glBindTexture (target, texture_id);
- glEnable (target);
glEnable (GL_SCISSOR_TEST);
glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -750,8 +746,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
}
}
-
glDisable (GL_SCISSOR_TEST);
- glDisable (target);
glDeleteTextures (1, &texture_id);
}
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 93d5d2c..829e302 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -238,7 +238,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
glPixelStorei (GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride (image_surface)/4);
- glTexImage2D (texture_target, 0, 4, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+ glTexImage2D (texture_target, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
cairo_image_surface_get_data (image_surface));
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
}
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 6960cae..a3a2d64 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2932,7 +2932,6 @@ gdk_window_begin_paint_region (GdkWindow *window,
glDisable (GL_DEPTH_TEST);
glDisable(GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glViewport (0, 0, ww, wh);
}
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 03a2220..6eed9f9 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -752,6 +752,8 @@ create_gl3_context (GdkDisplay *display,
*/
static const int attrib_list[] = {
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 2,
None,
};
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index a9dc310..cbf1c92 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -539,8 +539,6 @@ gtk_gl_area_post_render (GtkGLArea *area)
if (priv->auto_render)
invalidate[i++] = GL_COLOR_ATTACHMENT0;
-
- glInvalidateFramebuffer (GL_FRAMEBUFFER, i, invalidate);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]