Commit graph

191 commits

Author SHA1 Message Date
Philipp Wiesemann
c8c3817b12 Changed include directive to standard header. 2013-07-07 16:13:17 +02:00
Sam Lantinga
7ff764a482 Fixed the logical size for rendering to texture, thanks to Mason Wheeler.
Mason Wheeler

The SDL_RenderGetLogicalSize function should always return the amount of pixels that are currently available for rendering to.  But after updating to the latest SDL2, I started getting crashes because it was returning (0,0) as the logical size!  After a bit of debugging, I tracked it down to the following code in SDL_SetRenderTarget:

    if (texture) {
        renderer->viewport.x = 0;
        renderer->viewport.y = 0;
        renderer->viewport.w = texture->w;
        renderer->viewport.h = texture->h;
        renderer->scale.x = 1.0f;
        renderer->scale.y = 1.0f;
        renderer->logical_w = 0;
        renderer->logical_h = 0;
    }

This is obviously wrong; 0 is never the correct value for a valid renderer.  Those last two lines should read:

        renderer->logical_w = texture->w;
        renderer->logical_h = texture->h;
2013-06-29 14:40:55 -07:00
Sam Lantinga
8cf62ac298 Merged 2013-06-28 20:46:11 -07:00
Sam Lantinga
54060becd3 Fixed bug updating the clip rect for the software renderer 2013-06-27 11:27:19 -07:00
Sam Lantinga
86e40a29d3 Fixed bug 1929 - SDL_Texture* from SDL_CreateTexture() causes GL_BindTexture() to segfault
Charles Huber

If SDL_CreateTexture() takes the !IsSupportedFormat() path it will return a SDL_Texture* with a NULL driverdata member.

If you then SDL_GL_BindTexture() this will cause a segfault in GL_BindTexture() when it unconditionally dereferences driverdata.
2013-06-25 20:21:31 -07:00
Sam Lantinga
de9566518f Fixed some Visual Studio analyze warnings 2013-06-15 02:46:32 -07:00
Yuri K. Schlesner
5480cdd85c Re-apply texture filter when resetting direct3d renderer. 2013-05-29 06:31:48 -05:00
Sam Lantinga
20c5cf1e8b When the window is resized, the viewport is automatically reset.
This resolves lots of confusion around resizable windows.  Most people don't expect a viewport to be implicitly set when the renderer is created and then not to be reset to the window size if the window is resized.

Added common test command line parameters --logical WxH and --scale N to test the render logical size and scaling APIs.
2013-05-29 03:22:19 -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
Sam Lantinga
cbe94acd8e Fixed bug 1838 - [Patch] Direct3D resource leak on SDL_DestroyRenderer() 2013-05-16 00:56:19 -07:00
Philipp Wiesemann
337c6acc60 Inlined expression for consistency in render source. 2013-05-13 22:45:06 +02: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
Philipp Wiesemann
d7cb8fc61f Corrected spelling in internal include file. 2013-05-12 13:02:07 +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
Philipp Wiesemann
e2fe26af28 Fixed SDL_RenderSetClipRect() returning undefined instead of -1 on error. 2013-05-04 22:44:03 +02:00
Sam Lantinga
866f2e5f9e First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Sam Lantinga
b72f0b741e Fixed bug 1583 - Fix build for disabled SDL render subsystem
Marcus von Appen

If one wants to disable the SDL render subsystem, the build breaks on several platforms due to an empty render_drivers array in SDL_render.c.
2013-04-25 00:15:09 -07:00
Gabriel Jacobo
4b4bea7294 Fixes PSP_DestroyTexture release of data (don't release the SDL_Texture pointer) 2013-04-23 16:54:52 -03: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
71b29b3822 Don't use glDisable(GL_TEXTURE_2D) in GLES2 renderer.
Fixes Bugzilla #1799.

--HG--
extra : rebase_source : bdcc78e0cbdb2879c7ae24666bea567ce24dcd74
2013-04-17 11:45:50 -04:00
Andreas Schiffler
5bd319e5b5 Fix bug 1764: incorrect variable assignment in RenderDrawLinesWithRects 2013-04-17 07:35:30 -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
3afbe992d5 Removed Nintendo DS support since nobody has volunteered to maintain it for over a year. 2013-03-17 09:44:58 -07:00
Captain Lex
47dac69dc7 Add PSP support 2013-03-17 20:07:02 +08:00
Sam Lantinga
541a638836 Fixed compile errors on Windows 2013-03-06 09:45:53 -08:00
Sam Lantinga
4e631c1583 Fixed warning messages when loading Direct3D DLL
kmx

I have investigated the warning "Failed loading D3DX9_*.dll" and come up with the enclosed patch (please forward it to relevant SDL2 mailing list/bugtracker).
2013-03-05 18:52:25 -08:00
Sam Lantinga
4bb1b24573 Don't specify the texture unit when binding a texture, instead use whatever has been set up by the application.
This matches behavior in the OpenGL and OpenGL ES 1.1 renderers.
2013-03-03 11:25:43 -08:00
Sam Lantinga
7999859dda Fixed formatting 2013-03-03 11:25:09 -08:00
Sam Lantinga
7065167e8c Fixed bug 1728 - fixed compiler warnings 2013-02-26 03:34:34 -08:00
Sam Lantinga
fed4aded8f Fixed bug 1474 - OpenGL renderer can't to display YV12 texture. 2013-02-19 07:05:15 -08:00
Sam Lantinga
1a4596d798 Fixed bug 1722 - An attempt to release NULL Direct3d surface
Evgeny

static void
D3D_DestroyRenderer(SDL_Renderer * renderer)

has a critical problem. It may try to release IDirect3DSurface9 surface pointed
by NULL pointer. That leads to really wierd consequences on my system.

It happens when the previous call to IDirect3D9_CreateDevice() fails leaving
D3D_RenderData::defaultRenderTarget uninitialized.
2013-02-17 23:30:47 -08:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
5f3f837a42 Fixed bug 1491 - Directx3d Crash on resize
Spinduluz

RenderTarget has to be released before a device reset is done. It's a
D3DPOOL_DEFAULT surface (resides in video memory and have to be recreated).
2013-02-11 21:12:14 -08:00
Sam Lantinga
22321b18ef Fixed direction of rotation with OpenGL ES 2 2013-01-27 15:52:56 -08:00
Sam Lantinga
f4294fd806 Improvements from Alfred:
- Added new SDL_HINT_ALLOW_TOPMOST hint, when set to "0" then never set the topmost bit on a window. Useful when debugging fullscreen issues.
- fixed crash in windows joystick scanning if we failed to load the xinput dll
- added support for SDL_WINDOW_FULLSCREEN_DESKTOP under windows
- synthesize relative mouse movements if directinput fails to send relative moves, happens under virtual box.
2012-12-31 09:30:15 -08:00
Sam Lantinga
b1a587fdf7 The logical size set for a render target is temporary and shouldn't conflict with the logical size set for a window. 2012-10-12 02:56:41 -07:00
Sam Lantinga
015f8a0971 Fixed a bug resetting the viewport with a render target. 2012-10-12 02:30:03 -07:00
Sam Lantinga
59fea78fe0 Added SDL_GetRenderTarget() API function
Also fixed a bug with setting logical size for a render target.
2012-10-12 02:20:10 -07:00
Ryan C. Gordon
ec7e2d0865 Helps to initialize variables in the right function. :) 2012-10-03 20:02:13 -04:00
Ryan C. Gordon
8dedb98eef Fixed compiler warning. 2012-10-03 19:20:53 -04:00
Sam Lantinga
778d89e384 Fixed texture list when swapping textures (thanks Drake Wilson!) 2012-10-02 00:28:23 -07:00
Sam Lantinga
732be0727f Initialized default scale for software renderer (thanks Marcus von Appen!) 2012-10-01 23:28:19 -07:00
Sam Lantinga
93b3a23ff2 Fixed a compiler warning 2012-10-01 23:23:04 -07:00