mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
[cogl-draw-buffer] fix Cogl -> GL viewport coord conversion
Before we call glViewport we need to convert Cogl viewport coordinates (where the origin is defined to be top left) to OpenGL coordinates (where the origin is defined to be bottom left) We weren't considering that offscreen rendering is always upside down and in this case Cogl coordinates == OpenGL coordinates.
This commit is contained in:
parent
57bd250a71
commit
f910ce2ee5
@ -567,10 +567,17 @@ _cogl_draw_buffer_flush_state (CoglHandle handle,
|
||||
|
||||
if (ctx->dirty_gl_viewport)
|
||||
{
|
||||
int gl_viewport_y;
|
||||
|
||||
/* Convert the Cogl viewport y offset to an OpenGL viewport y offset
|
||||
* (NB: OpenGL defines its window and viewport origins to be bottom
|
||||
* left, while Cogl defines them to be top left.) */
|
||||
int gl_viewport_y = draw_buffer->height -
|
||||
* NB: OpenGL defines its window and viewport origins to be bottom
|
||||
* left, while Cogl defines them to be top left.
|
||||
* NB: We render upside down to offscreen draw buffers so we don't
|
||||
* need to convert the y offset in this case. */
|
||||
if (cogl_is_offscreen (draw_buffer))
|
||||
gl_viewport_y = draw_buffer->viewport_y;
|
||||
else
|
||||
gl_viewport_y = draw_buffer->height -
|
||||
(draw_buffer->viewport_y + draw_buffer->viewport_height);
|
||||
|
||||
GE (glViewport (draw_buffer->viewport_x,
|
||||
|
Loading…
Reference in New Issue
Block a user