Commit Graph

184 Commits

Author SHA1 Message Date
Sam Lantinga
028c19b92b 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
23f33cb76c 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
4d9fee966f 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
35f178cd7f Fixed declaration of GL_HandleDebugMessage 2013-05-19 22:57:01 -07:00
Sam Lantinga
a08ccfa9f8 Fixed windows build 2013-05-19 22:45:52 -07:00
Sam Lantinga
1063a72829 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
0d9b661db8 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Sam Lantinga
d6adde2adb Fixed bug 1838 - [Patch] Direct3D resource leak on SDL_DestroyRenderer() 2013-05-16 00:56:19 -07:00
Philipp Wiesemann
a19135fd1a Inlined expression for consistency in render source. 2013-05-13 22:45:06 +02:00
Philipp Wiesemann
08e8e38c86 Fixed building on Visual Studio.
Buildbot
2013-05-12 14:25:38 +02:00
Philipp Wiesemann
de43af1b54 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
539f60a57d Corrected spelling in internal include file. 2013-05-12 13:02:07 +02:00
Gabriel Jacobo
d36f97eb89 Fixed typo in GL_UpdateClipRect 2013-05-10 10:33:15 -03:00
Gabriel Jacobo
d4c2a87a5b Fixes OpenGL* Clip Rect functions (by Emmanuel Gil Peyrot) 2013-05-10 10:31:01 -03:00
Philipp Wiesemann
49b3851430 Fixed SDL_RenderSetClipRect() returning undefined instead of -1 on error. 2013-05-04 22:44:03 +02:00
Sam Lantinga
7253832be1 First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Sam Lantinga
c1bfee0f2d 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
de33c6164e 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ø
a228e5242a 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
295c17e99b Don't use glDisable(GL_TEXTURE_2D) in GLES2 renderer.
Fixes Bugzilla #1799.
2013-04-17 11:45:50 -04:00
Andreas Schiffler
fc589bd617 Fix bug 1764: incorrect variable assignment in RenderDrawLinesWithRects 2013-04-17 07:35:30 -07:00
Ryan C. Gordon
16cdc59bab 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
f0af9a3e70 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
a18bccd5f3 Add PSP support 2013-03-17 20:07:02 +08:00
Sam Lantinga
d71696b7f5 Fixed compile errors on Windows 2013-03-06 09:45:53 -08:00
Sam Lantinga
86ff46800f 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
aba5889732 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
e6bf874eff Fixed formatting 2013-03-03 11:25:09 -08:00
Sam Lantinga
d76c7254dd Fixed bug 1728 - fixed compiler warnings 2013-02-26 03:34:34 -08:00
Sam Lantinga
509366e2ca Fixed bug 1474 - OpenGL renderer can't to display YV12 texture. 2013-02-19 07:05:15 -08:00
Sam Lantinga
6b574f11e2 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
019c60c1e8 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
972b2abc34 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
6c353b0768 Fixed direction of rotation with OpenGL ES 2 2013-01-27 15:52:56 -08:00
Sam Lantinga
f425fe1358 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
e3c79c3a45 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
0ec818f3c0 Fixed a bug resetting the viewport with a render target. 2012-10-12 02:30:03 -07:00
Sam Lantinga
9a6b1c641a 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
6812b2e9cf Helps to initialize variables in the right function. :) 2012-10-03 20:02:13 -04:00
Ryan C. Gordon
f4c5703d8f Fixed compiler warning. 2012-10-03 19:20:53 -04:00
Sam Lantinga
04275d9bfb Fixed texture list when swapping textures (thanks Drake Wilson!) 2012-10-02 00:28:23 -07:00
Sam Lantinga
873ecde0ad Initialized default scale for software renderer (thanks Marcus von Appen!) 2012-10-01 23:28:19 -07:00
Sam Lantinga
a7dc767823 Fixed a compiler warning 2012-10-01 23:23:04 -07:00
Sam Lantinga
aab04f8c71 Added SDL_RenderSetLogicalSize() and SDL_RenderGetLogicalSize() 2012-10-01 22:30:07 -07:00
Sam Lantinga
f4bf4989ce The viewport is already scaled to the output coordinates 2012-10-01 21:57:09 -07:00
Sam Lantinga
8e121270fa Added SDL_RenderSetScale() and SDL_RenderGetScale() 2012-10-01 20:59:33 -07:00
Ryan C. Gordon
729074f469 Patched to compile on Visual Studio. 2012-09-28 14:17:30 -04:00
Sam Lantinga
e3d46eeb0a Fixed bug 1579 - Creating a texture with unsupported format may cause double-destruction
Alexander Hirsch 2012-08-25 20:01:29 PDT

When creating a SDL_Texture with unsupported format (I'll now refer to it as
texture A), SDL_CreateTexture will call SDL_CreateTexture again with
GetClosestSupportedFormat to set texture->native (which I will now refer to as
texture B).
This causes texture B to be put before A in renderer->textures.

If texture A is explicitly destroyed, everything is fine. Otherwise, upon
SDL_DestroyRenderer, the loop will first encounter texture B, destroy it, then
texture A, destroy that which will want to destroy texture->native and since it
is already destroyed set an error.

The solution could be as simple as swapping texture A with B after
texture->native gets set in SDL_CreateTextures.
2012-09-28 04:09:06 -07:00
Sam Lantinga
22025f3ce7 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
f02003f0ba Fixed memory leak in an error case 2012-09-28 02:43:13 -07:00