Commit Graph

67 Commits

Author SHA1 Message Date
Philipp Wiesemann
97aa577589 Fixed empty parameter list in signatures of internal functions. 2016-11-16 22:08:51 +01:00
Sam Lantinga
57d01d7d67 Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
e4af8ce968 Fixed typo getting the drawable size 2016-10-13 04:57:31 -07:00
Sam Lantinga
662f966cd9 Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer.
Call SDL_GL_GetDrawableSize() directly because we may be in the initialization path and SDL_GetRendererOutputSize() will fail because the renderer magic isn't set up yet.
2016-10-13 08:46:34 -07:00
Steffen Pankratz
564c790f33 Fixed a memory leak in function GL_RenderReadPixels 2016-10-11 17:31:29 +02:00
Sam Lantinga
27d4f09929 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Philipp Wiesemann
67bf5cac1a Fixed wrong pixel format if reading pixels from OpenGL renderer. 2016-10-02 22:32:35 +02:00
Sam Lantinga
fa0f417631 Fixed build warnings and errors 2016-10-01 14:48:18 -07:00
Sam Lantinga
77305d47c2 Fixed bug 3345 - SDL_RenderClear inconsistency with ClipRect
Simon Hug

The description of the SDL_RenderClear function in the SDL_render.h header says the following:

"This function clears the entire rendering target, ignoring the viewport."

The word "entire" implies that the clipping rectangle set with SDL_RenderSetClipRect also gets ignored. This is left somewhat ambiguous if only the viewport is mentioned. Minor thing, but let's see what the implementations actually do.

The software renderer ignores the clipping rectangle when clearing. It even has a comment on this: /* By definition the clear ignores the clip rect */

Most other render drivers (opengl, opengles, opengles2, direct3d, and psp [I assume. Can't test it.]) use the scissor test for the ClipRect and don't disable it when clearing. Clearing will only happen within the clipping rectangle for these drivers.

An exception is direct3d11 which uses a clear function that ignores the scissor test.
2016-10-01 11:46:32 -07:00
Sam Lantinga
061cc5e75f Fixed bug 3349 - GLES2_RenderReadPixels doesn't use target texture format
Simon Hug

The OpenGL ES 2 renderer does not check the target texture format when using SDL_RenderReadPixels and just always uses ABGR8888. This can result in swapped or wrong colors.

The attached patch adds a check and selects the target texture format, if a texture is set as the target.
2016-10-01 11:38:53 -07:00
Sam Lantinga
51d6371ec1 Fixed bug 3350 - GL renderers don't need to flip rows after reading back pixels from the target texture
Simon Hug

All OpenGL renderers always flip the rows of the pixels that come from glReadPixels. This is unnecessary for target textures since these are already top down.

Also, the rect->y value can be used directly for target textures for the same reason. I don't see any code that would handle the logical render size for target textures. Or am I missing something?

The attached patch makes the renderers only the flip rows if the data comes from the default framebuffer.
2016-10-01 11:34:04 -07:00
Sam Lantinga
a42c396a57 Fixed bug 3361 - Texture color modulation doesn't work with active NONE blend mode (opengl and opengles)
Simon Hug

The GL_SetBlendMode and GLES_SetBlendMode functions of the opengl and opengles renderers call the glTexEnvf to set the texture env mode to either GL_MODULATE (the default) or GL_REPLACE for the NONE blend mode. Using GL_REPLACE disables color and alpha modulation for textures.

These glTexEnv calls were put in the SetBlendMode function back in 2006 [1], but there the NONE code still used the GL_DECAL mode. The GL_REPLACE mode came in 2008 [2]. I'm a bit confused why that wasn't always GL_MODULATE and a bit surprised nobody reported that yet (unless I missed it). I guess only a few use the gles renderer and the newish shaders mask the issue.
2016-10-01 11:04:45 -07:00
Sam Lantinga
3f1b1629c4 Fixed bug 3362 - OpenGL renderer doesn't check if framebuffers are supported when creating target textures
Simon Hug

The GL_CreateTexture function doesn't have any checks for the case where the driver doesn't support the framebuffer object extension. It will call into GL_GetFBO which will call the non-existent glGenFramebuffersEXT.

Also, for some reason GL_CreateContext always sets the SDL_RENDERER_TARGETTEXTURE info flag, even if it is not supported. Changeset cc226dce7536 [1] makes this change, but doesn't explain why. It seems to me like the code would already have taken care of this [2].

The attached patch adds some checks and stops SDL from reporting render target support if there is none. The application can then properly inform the user instead of just crashing.
2016-10-01 10:52:24 -07:00
Sam Lantinga
42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
f893ce3d3e OpenGL+GLES renderers: Fixed incorrect clip rectangle coords (thanks, Marcel!).
Fixes Bugzilla #2700.
2015-12-28 15:15:58 -05:00
Alex Szpakowski
0c463d770b SDL_GL_GetAttribute: If a GL context isn't active, only return failure when the specified attribute needs an active GL context to be queried. 2015-12-10 20:25:34 -04:00
Philipp Wiesemann
0e45984fa0 Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00