[gtk/gtk-3-24: 1/2] Switch to GL_ARB_framebuffer_object
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] Switch to GL_ARB_framebuffer_object
- Date: Tue, 8 Jun 2021 14:59:06 +0000 (UTC)
commit 75a9f8dc92d68deba875ca210bf05c7b813f89bf
Author: Emmanuel Gil Peyrot <linkmauve linkmauve fr>
Date: Thu Jun 11 21:23:49 2020 +0200
Switch to GL_ARB_framebuffer_object
GTK+ 3.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.
gdk/gdkgl.c | 34 +++++++++++++++++-----------------
gtk/gtkglarea.c | 38 +++++++++++++++++++-------------------
2 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index 933e204439..9690077cc2 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -370,7 +370,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)
{
@@ -423,10 +423,10 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
framebuffer = paint_data->tmp_framebuffer;
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT, source);
- glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
+ glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, source);
+ glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
/* Translate to impl coords */
cairo_region_translate (clip_region, dx, dy);
@@ -481,11 +481,11 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
{
int clipped_src_x = x + (dest.x - dx * window_scale);
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
- glBlitFramebufferEXT(clipped_src_x, clipped_src_y,
- (clipped_src_x + dest.width), (clipped_src_y + dest.height),
- dest.x, FLIP_Y(dest.y + dest.height),
- dest.x + dest.width, FLIP_Y(dest.y),
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ glBlitFramebuffer (clipped_src_x, clipped_src_y,
+ (clipped_src_x + dest.width), (clipped_src_y + dest.height),
+ dest.x, FLIP_Y(dest.y + dest.height),
+ dest.x + dest.width, FLIP_Y(dest.y),
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (impl_window->current_paint.flushed_region)
{
cairo_rectangle_int_t flushed_rect;
@@ -505,7 +505,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glDisable (GL_SCISSOR_TEST);
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
+ glBindFramebuffer (GL_FRAMEBUFFER, 0);
#undef FLIP_Y
@@ -671,19 +671,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);
@@ -699,7 +699,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 9a56443725..802303ea9f 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -391,7 +391,7 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
priv->have_buffers = TRUE;
- glGenFramebuffersEXT (1, &priv->frame_buffer);
+ glGenFramebuffers (1, &priv->frame_buffer);
if (priv->has_alpha)
{
@@ -402,7 +402,7 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
/* Delete old render buffer if any */
if (priv->render_buffer != 0)
{
- glDeleteRenderbuffersEXT(1, &priv->render_buffer);
+ glDeleteRenderbuffers (1, &priv->render_buffer);
priv->render_buffer = 0;
}
}
@@ -410,7 +410,7 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
{
/* For non-alpha we use render buffers so we can blit instead of texture the result */
if (priv->render_buffer == 0)
- glGenRenderbuffersEXT (1, &priv->render_buffer);
+ glGenRenderbuffers (1, &priv->render_buffer);
/* Delete old texture if any */
if (priv->texture != 0)
@@ -423,12 +423,12 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
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;
}
@@ -515,23 +515,23 @@ 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)
- glFramebufferTexture2D (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, priv->texture, 0);
else if (priv->render_buffer)
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT, priv->render_buffer);
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, priv->render_buffer);
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);
}
}
@@ -547,7 +547,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
if (priv->render_buffer != 0)
{
- glDeleteRenderbuffersEXT (1, &priv->render_buffer);
+ glDeleteRenderbuffers (1, &priv->render_buffer);
priv->render_buffer = 0;
}
@@ -559,14 +559,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;
}
}
@@ -707,8 +707,8 @@ gtk_gl_area_draw (GtkWidget *widget,
w = gtk_widget_get_allocated_width (widget) * scale;
h = gtk_widget_get_allocated_height (widget) * scale;
- status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
- if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
+ status = glCheckFramebufferStatus (GL_FRAMEBUFFER);
+ if (status == GL_FRAMEBUFFER_COMPLETE)
{
if (priv->needs_render || priv->auto_render)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]