[gtk: 1/2] Switch to GL_ARB_framebuffer_object
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] Switch to GL_ARB_framebuffer_object
- Date: Sat, 20 Jun 2020 17:13:35 +0000 (UTC)
commit 404d79153eb33d2d85e3c40d371e70292175f2d8
Author: Emmanuel Gil Peyrot <linkmauve linkmauve fr>
Date: Fri Jun 12 15:08:44 2020 +0200
Switch to GL_ARB_framebuffer_object
GTK 4.0 was currently using GL_EXT_framebuffer_object, which is
deprecated as the ARB version has been merged into OpenGL 3.0 as well as
OpenGL ES 2.0, and provides laxer requirements.
This is a port of !2076 for 4.x.
gdk/gdkgl.c | 14 +++++++-------
gtk/gtkglarea.c | 28 ++++++++++++++--------------
2 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index dcaae81f3b..6ea045b9b0 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -348,7 +348,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
paint_data = gdk_gl_context_get_paint_data (paint_context);
if (paint_data->tmp_framebuffer == 0)
- glGenFramebuffersEXT (1, &paint_data->tmp_framebuffer);
+ glGenFramebuffers (1, &paint_data->tmp_framebuffer);
if (source_type == GL_RENDERBUFFER)
{
@@ -390,19 +390,19 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
framebuffer = paint_data->tmp_framebuffer;
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
+ glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
if (source_type == GL_RENDERBUFFER)
{
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT, source);
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, source);
}
else
{
- glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, source, 0);
+ glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, source, 0);
}
glPixelStorei (GL_PACK_ALIGNMENT, 4);
@@ -418,7 +418,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
+ glBindFramebuffer (GL_FRAMEBUFFER, 0);
cairo_surface_mark_dirty (image);
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index c91cc1e427..107e0940ff 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -366,17 +366,17 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
priv->have_buffers = TRUE;
- glGenFramebuffersEXT (1, &priv->frame_buffer);
+ glGenFramebuffers (1, &priv->frame_buffer);
if ((priv->has_depth_buffer || priv->has_stencil_buffer))
{
if (priv->depth_stencil_buffer == 0)
- glGenRenderbuffersEXT (1, &priv->depth_stencil_buffer);
+ glGenRenderbuffers (1, &priv->depth_stencil_buffer);
}
else if (priv->depth_stencil_buffer != 0)
{
/* Delete old depth/stencil buffer */
- glDeleteRenderbuffersEXT (1, &priv->depth_stencil_buffer);
+ glDeleteRenderbuffers (1, &priv->depth_stencil_buffer);
priv->depth_stencil_buffer = 0;
}
@@ -549,20 +549,20 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
else if (priv->needs_resize)
gtk_gl_area_allocate_buffers (area);
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, priv->frame_buffer);
+ glBindFramebuffer (GL_FRAMEBUFFER, priv->frame_buffer);
if (priv->texture != NULL)
- glFramebufferTexture2D (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, priv->texture->id, 0);
if (priv->depth_stencil_buffer)
{
if (priv->has_depth_buffer)
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, priv->depth_stencil_buffer);
if (priv->has_stencil_buffer)
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, priv->depth_stencil_buffer);
}
}
@@ -578,14 +578,14 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
if (priv->depth_stencil_buffer != 0)
{
- glDeleteRenderbuffersEXT (1, &priv->depth_stencil_buffer);
+ glDeleteRenderbuffers (1, &priv->depth_stencil_buffer);
priv->depth_stencil_buffer = 0;
}
if (priv->frame_buffer != 0)
{
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
- glDeleteFramebuffersEXT (1, &priv->frame_buffer);
+ glBindFramebuffer (GL_FRAMEBUFFER, 0);
+ glDeleteFramebuffers (1, &priv->frame_buffer);
priv->frame_buffer = 0;
}
}
@@ -716,8 +716,8 @@ gtk_gl_area_snapshot (GtkWidget *widget,
else
glDisable (GL_DEPTH_TEST);
- status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
- if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
+ status = glCheckFramebufferStatus (GL_FRAMEBUFFER);
+ if (status == GL_FRAMEBUFFER_COMPLETE)
{
Texture *texture;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]