Add gdk_gl_texture_quad() helper

Right now this just centralizes the glBegin/glEnd code, but
this will be replaced with buffer objects later.
This commit is contained in:
Alexander Larsson
2014-11-05 15:42:06 +01:00
parent 3c34ca3405
commit 10a44e8f7a
3 changed files with 38 additions and 40 deletions

View File

@ -469,19 +469,10 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *context,
vscale = 1.0 / cairo_xlib_surface_get_height (surface);
}
glBegin (GL_QUADS);
glTexCoord2f (uscale * src_x, vscale * (src_y + src_height));
glVertex2f (rect.x * window_scale, FLIP_Y(rect.y + rect.height) * window_scale);
glTexCoord2f (uscale * (src_x + src_width), vscale * (src_y + src_height));
glVertex2f ((rect.x + rect.width) * window_scale, FLIP_Y(rect.y + rect.height) * window_scale);
glTexCoord2f (uscale * (src_x + src_width), vscale * src_y);
glVertex2f ((rect.x + rect.width) * window_scale, FLIP_Y(rect.y) * window_scale);
glTexCoord2f (uscale * src_x, vscale * src_y);
glVertex2f (rect.x * window_scale, FLIP_Y(rect.y) * window_scale);
glEnd();
gdk_gl_texture_quad (rect.x * window_scale, FLIP_Y(rect.y) * window_scale,
(rect.x + rect.width) * window_scale, FLIP_Y(rect.y + rect.height) * window_scale,
uscale * src_x, vscale * src_y,
uscale * (src_x + src_width), vscale * (src_y + src_height));
}
glXReleaseTexImageEXT (glx_pixmap->display, glx_pixmap->drawable,