[OpenGL Renderer]: Setting ClipRect and Viewport

Is setting the ClipRect and the Viewport the same thing for the OpenGL renderer?? Because, both after
a few tests, as well looking at the source code in ‘GL_UpdateViewport()’, that seems to be the case. That
is, setting the viewport actually sets a ClipRect (the content is not minimized, it is clipped). Is this the
intended behaviour for the Render API, or a bug??

If it is a bug, then I guess, something is quite wrong with the glOrtho() calls in ‘GL_UpdateViewport()’.
Unfortunately, I cannot check this right now, but the same clipping is done at the software renderer, too.

Thanks,
Aggelos Kolaitis------------------------
C is the God’s Programming Language

You aren’t supposed to mix raw OpenGL calls with a renderer. The whole
point of the renderers is so you don’t have to use those APIs.

In other words: undefined behavior. Just because it works now doesn’t
mean it’ll work later.

2013/8/31, neoaggelos :> Is setting the ClipRect and the Viewport the same thing for the OpenGL

renderer?? Because, both after
a few tests, as well looking at the source code in ‘GL_UpdateViewport()’,
that seems to be the case. That
is, setting the viewport actually sets a ClipRect (the content is not
minimized, it is clipped). Is this the
intended behaviour for the Render API, or a bug??

If it is a bug, then I guess, something is quite wrong with the glOrtho()
calls in ‘GL_UpdateViewport()’.
Unfortunately, I cannot check this right now, but the same clipping is done
at the software renderer, too.

Thanks,
Aggelos Kolaitis


C is the God’s Programming Language

That’s the thing: I’m not mixing OpenGL calls with the Render API, I was referring to the the calls in ‘glOrtho()’ in ‘src/render/opengl/SDL_render_gl.c’ (line 865+).

After some more testing, I found out that if the viewport size is bigger than the window, then the whole scene is moved upwards, and aligned in the top-left corner of the viewport rect (outside of the window). Shouldn’t that be the bottom-left corner???

Well, either something is really messed up or I’m missing a huge part of ‘SDL_RenderSetViewport()’.

Luckily, I was able to come up with a solution for the original problem that led me to make this question, so from now on the discussion is purely academical for me.On Sep 1, 2013, at 12:58 AM, Sik the hedgehog <sik.the.hedgehog at gmail.com> wrote:

You aren’t supposed to mix raw OpenGL calls with a renderer. The whole
point of the renderers is so you don’t have to use those APIs.

In other words: undefined behavior. Just because it works now doesn’t
mean it’ll work later.

2013/8/31, neoaggelos <@Aggelos_Kolaitis>:

Is setting the ClipRect and the Viewport the same thing for the OpenGL
renderer?? Because, both after
a few tests, as well looking at the source code in ‘GL_UpdateViewport()’,
that seems to be the case. That
is, setting the viewport actually sets a ClipRect (the content is not
minimized, it is clipped). Is this the
intended behaviour for the Render API, or a bug??

If it is a bug, then I guess, something is quite wrong with the glOrtho()
calls in ‘GL_UpdateViewport()’.
Unfortunately, I cannot check this right now, but the same clipping is done
at the software renderer, too.

Thanks,
Aggelos Kolaitis


C is the God’s Programming Language


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org