Commit Graph

131 Commits

Author SHA1 Message Date
Sam Lantinga
03410caaaf Renamed SDL_GL_CONTEXT_PROFILE_ES2 to SDL_GL_CONTEXT_PROFILE_ES 2012-08-12 23:10:16 -07:00
Sam Lantinga
c5eed5e522 Fixed bug 1565 - some small GL context creation enhancements
Matthias Bentrup 2012-08-09 12:53:17 PDT

With OpenGL 4.3 the ARB added a new context flag for context reset isolation
and renamed the existing ES2 profile bit to ES profile bit, as it can be used
to request GLES 3 compatible contexts, too.

This patch adds these changes to SDL on Linux and Windows.

Also SDL lacks the ability to create shared contexts. This patch also adds a
new GL attribute to enable context sharing. As casting a GL context to int is
not portable, I added only a boolean attribute
SDL_GL_SHARE_WITH_CURRENT_CONTEXT, which makes the new context share resources
with the context current on the creating thread.
2012-08-12 11:16:24 -07:00
Ryan C. Gordon
f32956dc1b Add support for (GLX|WGL)_EXT_swap_control_tear.
This required a small public API change: SDL_GL_SetSwapInterval() now accepts
 negative values, and SDL_GL_GetSwapInterval() doesn't report errors anymore
 (if it can't work, it'll return zero as a reasonable default).

If you need to test for errors, such as a lack of swap_control_tear support,
 check the results of SDL_GL_SetSwapInterval() when you set your desired
 value.
2012-08-01 20:29:36 -04:00
Sam Lantinga
719eabe5ee Improved simultaneous support for OpenGL and OpenGL ES
From Scott Percival

Okay, I think I have something for this. Tested it on GL and GLES
machines, it seems to work okay.

- Add a new SDL GL attribute SDL_GL_CONTEXT_EGL:
        - Only useful for the X11 video driver at the moment
        - Set to 1 for an EGL context, 0 to use the default for the video driver
        - Default is 0, unless library is built for EGL only
        - Should be set after SDL init, but before window/context
creation (i.e. same place you'd specify attributes for major/minor GL
version)
- After a lot of agony pondering the least-terrible way to go about
it, made it so that X11_GL_LoadLibrary and X11_GLES_LoadLibrary check
SDL_GL_CONTEXT_EGL. If no GL context exists yet, and the attribute
choice doesn't match with the checking function, then it changes all
the function pointers in the video driver and passes control on to the
new LoadLibrary method.
- Likewise, make X11_CreateWindow check this attribute before firing
off a call to X11_GL_GetVisual/X11_GLES_GetVisual
- Added a sanity check to the start of X11_GL_LoadLibrary
- Tidied up SDL_x11opengles.h
- Moved ownership of the gles_data structure over to
X11_GLES_LoadLibrary/UnloadLibrary
- Should incorporate the 3 fixes posted by Andre Heider

This is obviously quite a bit to take in, but is (at least) a proof of
concept for the approach I think EGL/GLX mingling should take. Any
comments/criticism is much appreciated.
2012-07-18 15:17:27 -07:00
Sam Lantinga
c24538ae24 Add OpenGL 3.X context creation support
Matthias Bentrup 2011-10-30 03:58:24 PDT

I've updated the context creation patch to include the bugfixes by Martin
Schreiber and also included a profile bit to request a ES2 compatible profile.

The wgl context creation may use 2 call to wglChoosePixelFormat if no
acceleration attribute is selected, this should work around a bug with buggy
AMD drivers (see #1254).
2012-02-20 23:37:57 -05:00
Sam Lantinga
e256711bb9 Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
fa1116223a Clarified SDL_GetWindowSurface() documentation
Matthew Orlando to Sam

Someone asked in IRC whether they should free the surface from SDL_GetWindowSurface. The doc comment is a bit vague so i checked the code and revised the comment.
2011-04-22 09:06:29 -07:00
Sam Lantinga
6196aa221e SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
023e6fa996 Fixed related function documentation 2011-03-22 10:48:33 -07:00
Sam Lantinga
069fbf4861 Gamma support is back!
New API functions:
	SDL_SetWindowBrightness()
	SDL_GetWindowBrightness()
	SDL_SetWindowGammaRamp()
	SDL_GetWindowGammaRamp()
	SDL_CalculateGammaRamp()
2011-03-11 08:49:20 -08:00
Sam Lantinga
d5783ef521 Use boolean value for input grab mode, like we do for fullscreen mode. 2011-02-27 20:06:45 -08:00
Sam Lantinga
f3c377a8f2 Simplified and unified the window creation process a little. 2011-02-21 22:03:39 -08:00
Sam Lantinga
b59da3ffdc Changed the concept of a render clip rect to a render viewport.
The render viewport is automatically re-centered when the window changes size, so applications that don't care will not have to handle recalculating their rendering coordinates.

Fixed API for drawing and filling multiple rectangles - the parameter should be an array of rects, not an array of pointers to rects.

Fixed API for updating window rects for consistency with other APIs - the order is pointer to array followed by count in array.
2011-02-15 13:59:59 -08:00
Sam Lantinga
e6ec7f6b28 Fixed bug #1117
There's a new event that's always sent when the window changes size, and that event is what the renderers listen for to determine if they need to rebind their context.
2011-02-12 19:02:14 -08:00
Sam Lantinga
c3265bbc90 changeset: 5272:cb08ef104ac4
tag: tip
user: Martin Decky <martin@decky.cz>
date: Sat Feb 12 20:53:06 2011 +0100
summary: improve header files compatibility with SDL 1.2 applications (namely QEMU)
2011-02-12 12:04:00 -08:00
Sam Lantinga
a2cdcf5486 Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
37993063c6 Window coordinates are in the global space and windows are not tied to a particular display.
Also added Ctrl-Enter keybinding to the test code to toggle fullscreen mode for testing.
2011-02-10 14:44:25 -08:00
Sam Lantinga
debc4678c8 Be explicit about what display you're querying. The default display is 0. 2011-02-10 12:14:37 -08:00
Sam Lantinga
f2729d2d2c Removed gamma support since it wasn't widely used and not well supported. 2011-02-10 11:39:08 -08:00
Sam Lantinga
93a4e38e98 Added a way to get a framebuffer interface for a window, and also a way to create a software renderer for an arbitrary surface.
The software renderer has been re-routed to use the framebuffer interface, which makes it possible to have software rendering available even on simple ports.
2011-02-03 15:49:37 -08:00
Sam Lantinga
7880fa3997 Extended SDL_SetWindowData() to allow arbitrary named values. 2011-02-03 11:16:57 -08:00
Sam Lantinga
8bf50cc83c Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library. 2011-02-02 14:34:54 -08:00
Sam Lantinga
1f34b65342 Making the API simpler, removed support for palettized video modes and textures. 2011-02-01 21:23:43 -08:00
Sam Lantinga
f729dd20de Split the rendering API out into a separate header file. 2011-02-01 15:02:21 -08:00
Sam Lantinga
5d5f352744 Renumbered the renderer flags 2011-02-01 12:44:52 -08:00
Sam Lantinga
88718ffabe Making the API simpler, the renderer present semantics are always having a backbuffer and then discarding it. This is best for hardware accelerated rendering. 2011-02-01 12:19:46 -08:00
Sam Lantinga
fb80cf39a4 Making the API simpler, texture color and alpha modulation are supported by all renderers. 2011-01-31 23:37:30 -08:00
Sam Lantinga
0efb1ea0b2 Making the API simpler, the blend modes are "none, blend, add" and are supported by all renderers. 2011-01-31 23:23:57 -08:00
Sam Lantinga
471a85fb52 Making the API simpler, scaling is always defined as linear interpolation and should be supported as much as possible on all renderers. 2011-01-31 22:44:43 -08:00
Sam Lantinga
74a3510cf2 Removed completely non-portable event thread hack.
Next I'll be working on generalizing the event sources and making the event queue lock-free. :)
2011-01-27 22:44:08 -08:00
Sam Lantinga
15e43076a4 Updated headers to match wiki documentation 2011-01-12 09:47:33 -08:00
Sam Lantinga
d6eac2c481 Use the enumerated type for blend and scale mode instead of int
Renamed SDL_TextureScaleMode to SDL_ScaleMode
2010-12-12 15:19:05 -08:00
Sam Lantinga
864edec6b4 Fixed grammar, thanks to Sheena's suggestion. 2010-09-18 17:12:19 -07:00
Sam Lantinga
823c38786d Fixed documentation 2010-09-14 21:57:29 -07:00
Sam Lantinga
f5f5c845ae Documentation consistency 2010-08-29 22:34:50 -07:00
Sam Lantinga
c9ac1fe3e5 Documentation consistency 2010-08-29 22:28:38 -07:00
Sam Lantinga
4913c48bba Fixed typo in header 2010-08-29 22:22:27 -07:00
Sam Lantinga
a14a177d5f Documentation clarification 2010-08-29 22:12:59 -07:00
Sam Lantinga
e7789ad75b Suspending the screensaver defaults off. 2010-08-29 21:41:11 -07:00
Sam Lantinga
b66ae96de5 Documentation clarification 2010-08-29 15:26:12 -07:00
Sam Lantinga
617542daf6 Merged Sunny's XRender changes from SDL-gsoc2010_xrender 2010-07-28 00:54:23 -07:00
Sunny Sachanandani
2fcfc81241 Advertise support for all supported texture formats. 2010-07-22 10:53:41 +05:30
Sam Lantinga
4b1c945432 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Plus, this lets me start implementing cursor support.
2010-05-09 20:47:22 -07:00
Sam Lantinga
7052036491 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010
2010-01-24 21:10:53 +00:00
Sam Lantinga
8de28c8753 Documentation consistency 2010-01-22 06:50:17 +00:00
Sam Lantinga
e0a31b4dbb Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance. 2010-01-21 06:21:52 +00:00
Sam Lantinga
4416d51d59 Fixed compiler warning 2010-01-18 14:16:47 +00:00
Sam Lantinga
25ddd3c390 Removed in the interest of actually finishing 1.3. :)
They can be done later, either by me or by someone else.
2009-12-30 19:10:41 +00:00
Sam Lantinga
c3629ff44a Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color.
Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine().
Added API for rectangle drawing (as opposed to filling)
Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay.
Optimized software line drawing quite a bit.
Added support for Wu's anti-aliased line drawing, currently disabled by default.
2009-12-23 01:55:00 +00:00
Sam Lantinga
70a40d51b2 Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
    SDL_BlendPoints()
    SDL_BlendLines()
    SDL_DrawLines()
    SDL_FillRects()
    SDL_BlendRects()
    SDL_RenderPoints()
    SDL_RenderLines()
    SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()
2009-12-09 15:56:56 +00:00