Commit graph

67 commits

Author SHA1 Message Date
Sam Lantinga
43cc5c1cbb Added optimized YUV texture upload path with SDL_UpdateYUVTexture() 2013-09-28 14:06:47 -07:00
Edward Rudd
3a11d95444 add in High DPI support (aka Retina)
- based on Jørgen's patch with a few bug fixes
2013-09-20 13:43:00 -04:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Gabriel Jacobo
298ce1c1a7 OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
Gabriel Jacobo
271e0d67c4 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Sam Lantinga
42c560b05d Check the return value of glGenTextures()
--HG--
extra : rebase_source : e079554f253890d862bfd5d51d7b229e3fcff3d9
2013-08-10 10:49:26 -07:00
Sam Lantinga
32188834b5 Updated blend semantics so blending uses the following formula:
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
    dstA = srcA + (dstA * (1-srcA))
This allows proper compositing semantics without requiring premultiplied alpha.

Needs full unit test coverage and bug fixes!
2013-07-23 08:06:49 -07:00
Ryan C. Gordon
51ba788d0d Don't try to clear errors in GL_ActivateRenderer() before we MakeCurrent.
Otherwise, if we destroyed a different renderer, next time this one draws,
it'll clear errors forever (GL_INVALID_OPERATION for having no current
context, at least on Windows), hanging up the program in an infinite loop.

Fixes Bugzilla #1775.
2013-07-20 21:10:05 -04:00
Sam Lantinga
ee12cc8585 Fixed bug 1810 - xxx_RenderReadPixels - incorrect behaviour in certain conditions
PoopiSan

GLES2_RenderReadPixels, GLES_RenderReadPixels, GL_RenderReadPixels and possibly other backends is incorrectly implemented.

If the current target viewport is different than window size the function is reading garbage and according to the function documentation should work with any rendering target "Read pixels from the current rendering target.".

this seems to be caused by this line:

...
SDL_GetWindowSize(window, &w, &h);
2013-07-12 00:55:04 -07:00
Sam Lantinga
c55f53aa40 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()
2013-05-29 03:07:55 -07:00
Sam Lantinga
f56b6fdc45 It turns out that GL_ARB_debug_output is really only useful on debug contexts, so for consistency and performance we'll only check and report errors on debug contexts.
I added a --gldebug command line option for the test programs to easily test this, and we may want a hint as well to enable OpenGL error checking.
2013-05-20 12:01:31 -07:00
Sam Lantinga
635a32ed58 Fixed declaration of GL_HandleDebugMessage 2013-05-19 22:57:01 -07:00
Sam Lantinga
11dfd2bff8 Fixed windows build 2013-05-19 22:45:52 -07:00
Sam Lantinga
91ff680aa5 Fixed bug 1837 - Use error extension instead of glGetError()
Implemented support for GL_ARB_debug_output, but was unable to test it on Mac OS X.
2013-05-19 22:28:10 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Philipp Wiesemann
6814d3a09c Fixed building on Visual Studio.
Buildbot
2013-05-12 14:25:38 +02:00
Philipp Wiesemann
df60747e3b Fixed bug 1844 - glScissor calls are wrong - Patch attached
Martin Gerhardy

the coordinate system from sdl is not correctly transformed to the coordinate system of opengl. glScissor expects them to be a little bit different. Attached is a patch that fixes this
2013-05-12 13:40:02 +02:00
Gabriel Jacobo
293da630b8 Fixed typo in GL_UpdateClipRect 2013-05-10 10:33:15 -03:00
Gabriel Jacobo
7065c6467d Fixes OpenGL* Clip Rect functions (by Emmanuel Gil Peyrot) 2013-05-10 10:31:01 -03:00
Sam Lantinga
866f2e5f9e First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Jørgen P. Tjernø
187143d618 SDL_GL_DeleteContext would leave an invalid current_glctx.
Calling SDL_GL_DeleteContext wouldn't update current_glctx, so you could
end up with use-after-free and other goodies when you deleted a context.
2013-04-22 18:15:08 -07:00
Ryan C. Gordon
4f438b70a2 Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
f366b098d4 Added SDL_RenderSetScale() and SDL_RenderGetScale() 2012-10-01 20:59:33 -07:00
Ryan C. Gordon
3861a6c17c Patched to compile on Visual Studio. 2012-09-28 14:17:30 -04:00
Sam Lantinga
c328979f60 Fixed bug 1584 - Improved glError checks in the opengl renderer
Martin Gerhardy 2012-08-27 02:42:25 PDT

I've extended the gl error checks.

This is needed because on my system there are errors in the renderer that are
hard to find.

Also glError can return multiple errors. Even if SDL_SetError would only
contain the last one of course, the SDL log facilities are able to get the
output for each error.
2012-09-28 03:49:27 -07:00
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
48b953ddbe Fixed bug 1591 - Renderer maximum texture size is incorrect when GL_ARB_texture_rectangle is active 2012-09-23 01:50:35 -07:00
Gabriel Jacobo
bd7b381374 Implements SDL_GL_BindTexture and SDL_GL_UnbindTexture (#1576) 2012-09-03 11:16:12 -03:00
Gabriel Jacobo
17bdcc6e8e RenderCopyEx,rotation and flipping for all hardware/software backends (#1308) 2012-06-01 19:51:08 -03:00
Sam Lantinga
aaf23fe8af Fixed loading textures when the window starts hidden.
The viewport automatically resets to the window size when you programmatically resize the window.
2012-01-22 21:46:06 -05:00
Sam Lantinga
0458fa488a Renamed SetTargetTexture() to SetRenderTarget() 2012-01-22 01:26:28 -05:00
Sam Lantinga
da686e5bd4 Reorganized the render target code, moving the viewport handling to the general code and adding software implementation. 2012-01-21 22:22:30 -05:00
Sam Lantinga
23b96d3406 Added a renderer flag to expose whether a renderer supports render to texture. 2012-01-19 21:06:47 -05:00
Sam Lantinga
a49a88676f Implementation of render targets, by Mason Wheeler and Gabriel Jacobo
Thanks guys!
2012-01-18 22:45:49 -05:00
Sam Lantinga
7083b58688 Fixed bug 1331 - SDL_CreateTextureFromSurface fails for OpenGL + Win XP 64 NVidia 285.58 with GL_INVALID_ENUM
I think this fixes the bug.  I'm not sure why it would fail, and it may have something to do with the version of OpenGL that we initialize and use by default. Regardless, this should take care of the problem.
2012-01-10 21:00:47 -05:00
Sam Lantinga
6261562fa0 Fixed crash if the rendering system couldn't create an OpenGL window. 2012-01-07 21:01:33 -08:00
Sam Lantinga
8bf062f32b Fixed bug 1256 - Invalid window warning in GL_CreateRenderer
Martin Gerhardy 2011-07-27 02:26:06 PDT
the window reference is lost in the GL_CreateRenderer function. The attached
patch should fix this error.

#0  SDLSystem_LogOutputFunction (userdata=0x63b010, category=1,
priority=SDL_LOG_PRIORITY_ERROR, message=0x7fffffffcd00 "Invalid window") at
src/system/sdl/SDLSystem.cpp:8
#1  0x00007ffff7b1ddb3 in SDL_LogMessageV (category=1,
priority=SDL_LOG_PRIORITY_ERROR, fmt=<value optimized out>, ap=<value optimized
out>) at src/SDL_log.c:275
#2  0x00007ffff7b1df7c in SDL_LogError (category=<value optimized out>,
fmt=<value optimized out>) at src/SDL_log.c:212
#3  0x00007ffff7b1d582 in SDL_SetError (fmt=0x7ffff7baaff0 "") at
src/SDL_error.c:111
#4  0x00007ffff7b96f9e in SDL_GL_MakeCurrent (window=0x0, ctx=0xa62ce0) at
src/video/SDL_video.c:2484
#5  0x00007ffff7b4ba0c in GL_ActivateRenderer (renderer=0xa8f680) at
src/render/opengl/SDL_render_gl.c:195
#6  0x00007ffff7b4c59a in GL_ResetState (window=0x918010, flags=<value
optimized out>) at src/render/opengl/SDL_render_gl.c:214
#7  GL_CreateRenderer (window=0x918010, flags=<value optimized out>) at
src/render/opengl/SDL_render_gl.c:343
#8  0x00007ffff7b48053 in SDL_CreateRenderer (window=0x918010, index=<value
optimized out>, flags=2) at src/render/SDL_render.c:166
2012-01-07 02:32:08 -05:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
98615b55aa Fixed bug 1315 - Greenish video when video size smaller than texture
The incoming pixels are contiguous for the update rectangle.
2011-12-30 18:18:42 -05:00
Ryan C. Gordon
bc13816375 Fixed a whole slew of compiler warnings that -Wall exposed. 2011-10-13 01:08:30 -04:00
Ryan C. Gordon
2fdcb7bdfc Fixed memory leak in SDL_DestroyRenderer.
Fixes Bugzilla #1219.

Thanks to Dimitris Zenios for the patch!
2011-07-16 14:59:12 -07:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
b547542f70 The scale mode is per texture, not per texture unit. 2011-03-21 17:15:49 -07:00
Sam Lantinga
a19e258730 Added the SDL_HINT_RENDER_SCALE_QUALITY hint, which defaults to nearest pixel sampling. 2011-03-13 11:18:35 -07:00
Sam Lantinga
45d991f20d Fixed permissions for C source files 2011-03-11 11:52:41 -08:00
Sam Lantinga
2f6aa755d6 Fixed bug 1162 (Error calling SDL_RenderReadPixels() with format=0) 2011-03-10 01:03:43 -08:00
Sam Lantinga
ce2aa2ee1d Zero streaming textures at the driver level 2011-02-26 21:39:34 -08:00
Sam Lantinga
0dd9ad216f Hopefully fixed crashes when creating multiple streaming textures of different sizes. 2011-02-24 23:42:58 -08:00
Sam Lantinga
9da77abd36 Fixed compiler warnings 2011-02-21 22:26:59 -08:00