Fixed bug 1622 - SDL_RenderSetViewport with empty SDL_Rect raises wrong error for OpenGL rendering backend

It's now legal to set an empty viewport rect - it will prevent any rendering.

Also added an API to query the output size: SDL_GetRendererOutputSize()
This commit is contained in:
Sam Lantinga 2013-05-29 03:07:55 -07:00
parent b337b40e33
commit c55f53aa40
8 changed files with 103 additions and 64 deletions

View file

@ -906,6 +906,10 @@ GLES2_SetOrthographicProjection(SDL_Renderer *renderer)
GLfloat projection[4][4];
GLuint locProjection;
if (!renderer->viewport.w || !renderer->viewport.h) {
return 0;
}
/* Prepare an orthographic projection */
projection[0][0] = 2.0f / renderer->viewport.w;
projection[0][1] = 0.0f;