|
0e9c0855
|
2014-07-08T16:17:06
|
|
Comment update: SDL_INIT_NOPARACHUTE doesn't do anything as of 2.0.0.
|
|
8077bf3d
|
2014-07-07T21:27:42
|
|
Fixed bug 2618 - incomplete pthread-based lock support should be removed
binarycrusader
Since changeset 358696c354a8, SDL 2.0 has been broken on Solaris when compiling with the Solaris Studio compiler (which uses the pthread implementation of SDL_AtomicLock).
Notably, it gets stuck at the MemoryBarrierRelease in SDL_GetErrBuf:
6585 # 218
6586 if (!tls_errbuf && !tls_being_created) {
6587 SDL_AtomicLock_REAL ( & tls_lock );
6588 if (!tls_errbuf) {
6589 SDL_TLSID slot;
6590 tls_being_created = SDL_TRUE;
6591 slot = SDL_TLSCreate_REAL ( );
6592 tls_being_created = SDL_FALSE;
6593 { SDL_SpinLock _tmp = 0 ; SDL_AtomicLock_REAL ( & _tmp ) ; SDL_AtomicUnlock_REAL ( & _tmp ) ; };
^^^ loops forever above
6594 tls_errbuf = slot;
6595 }
6596 SDL_AtomicUnlock_REAL ( & tls_lock );
6597 }
Running: testthread
(process id 28926)
^Cdbx: warning: Interrupt ignored but forwarded to child.
signal INT (Interrupt) in __nanosleep at 0xfe52a875
0xfe52a875: __nanosleep+0x0015: jae __nanosleep+0x23 [ 0xfe52a883, .+0xe ]
Current function is SDL_Delay_REAL
204 was_error = nanosleep(&tv, &elapsed);
(dbx) where
[1] __nanosleep(0xfeffe848, 0xfeffe850, 0xfe75a5ac, 0xfe5169d8), at 0xfe52a875
[2] nanosleep(0xfeffe848, 0xfeffe850), at 0xfe516a3b
=>[3] SDL_Delay_REAL(ms = 0), line 204 in "SDL_systimer.c"
[4] SDL_AtomicLock_REAL(lock = 0xfeffe88c), line 104 in "SDL_spinlock.c"
[5] SDL_GetErrBuf(), line 225 in "SDL_thread.c"
[6] SDL_ClearError_REAL(), line 216 in "SDL_error.c"
[7] SDL_InitSubSystem_REAL(flags = 0), line 116 in "SDL.c"
[8] SDL_Init_REAL(flags = 0), line 244 in "SDL.c"
[9] SDL_Init(a = 0), line 89 in "SDL_dynapi_procs.h"
[10] main(argc = 1, argv = 0xfeffe948), line 65 in "testthread.c"
As far as I can tell, this is because pthread_spin_trylock() always returns EBUSY for this particular lock; since it works in other places, I'm suspicious.
Different Solaris Studio compiler versions seem to make no difference.
I've verified this is broken on Linux as well if SDL_spinlock.c is modified to use the pthread implementation.
This appears to be because pthread_spin_init() and pthread_spin_destroy() are not used with the locks as required.
|
|
c5812c55
|
2014-07-05T16:11:23
|
|
2620 solaris port missing atomics if not using gcc
|
|
cf4ff728
|
2014-07-04T18:20:23
|
|
Made the latest XInput + Haptic changes compile and run on WinRT
Notes:
- Support for the 'Guide' button does not seem to be possible, as
XInputGetStateEx is not available on WinRT.
- Haptic support appears to be working on WinRT now!
- SDL/WinRT does not allow calls to LoadLibrary or LoadLibraryEx. The calls
to those were removed by this change, but only when compiling for WinRT.
Non-WinRT Windows will continue to detect and load XInput via LoadLibrary and
GetProcAddress calls.
|
|
b79e7f32
|
2014-07-03T15:39:55
|
|
Split the XInput and DirectInput code so Windows RT can use the existing XInput support.
|
|
321af03f
|
2014-07-03T10:22:26
|
|
add a comment to SDL_InitSubSystem explaining its refcounting behavior
|
|
744d4f02
|
2014-06-30T17:22:08
|
|
Apply WIN32_LEAN_AND_MEAN redefine fix to SDL_syswm.h too.
This is related to 36ffc47b6033, which fixes bug 2508.
|
|
02e9f81e
|
2014-06-28T12:17:29
|
|
SDL_egl: allow creation of versioned OpenGL contexts with EGL_KHR_create_context
If the EGL extension EGL_KHR_create_context is available, we can use it to
set the core/compatability profile and the minimum OpenGL version.
Use this if it is available to get the context requested by the GL attributes.
|
|
b29740b8
|
2014-06-25T17:06:12
|
|
Merged Ryan's SDL-gui-backend branch.
Adds three APIs, and implements them on X11, Cocoa, and Windows:
- SDL_CaptureMouse()
- SDL_GetGlobalMouseState()
- SDL_SetWindowHitTest()
|
|
84369567
|
2014-06-25T16:16:55
|
|
Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState().
This matches naming conventions in the main repository, between
SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
|
|
6a632eb2
|
2014-06-25T00:20:21
|
|
Fixed bug 2603 - iOS: update joystick accelerometer code to use CoreMotion instead of the deprecated UIAccelerometer
Alex Szpakowski
SDL's code for exposing the accelerometer as a joystick on iOS currently uses UIAccelerometer, which was superseded by the CoreMotion framework and deprecated since iOS 5.
The UIAccelerometer code still works (for now), but it also throws deprecation warnings whenever SDL is built for iOS, since SDL's deployment target is no longer below iOS 5.
I've created a patch which replaces the old UIAccelerometer code with a replacement based on the CoreMotion framework. It has identical functionality (to SDL users), however iOS apps are now required to link to the CoreMotion framework when using SDL.
|
|
52ec151f
|
2014-06-24T13:31:25
|
|
Fixed bug 2553 - Add support to all XInput devices
This adds support for all XInput devices, exposed through the SDL joystick API.
The button and axis reporting for XInput devices has been changed to match DirectInput and other platforms.
The game controller xinput mapping has been updated so this change is seamless.
There is a new hint, SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, for any applications that have hardcoded the old xinput button and axis set. This hint will be removed in SDL 2.1.
|
|
3344db40
|
2014-06-23T11:06:50
|
|
Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
|
|
e8d84fbf
|
2014-06-21T20:35:36
|
|
Merged changes from Alexey Petruchik to support Android obb files
http://developer.android.com/google/play/expansion-files.html
|
|
d7924c73
|
2014-06-21T12:43:57
|
|
Fixed bug 2563 - Remove obsolete code for supporting iOS < 5
Alex Szpakowski
Now that SDL for iOS requires at least iOS 5.1 at runtime, there are several old codepaths in the UIKit backend which can be removed. I've attached a patch which does so.
|
|
ce84813a
|
2014-06-21T11:24:06
|
|
commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Author: Sam Clegg <sbc@chromium.org>
Date: Fri Jun 20 12:52:11 2014
Fix win32 build which was failing due to missing PRIs64.
This change adds definitions for the C99 PRIs16 and PRIu64
which are missing from <stdint.h> on at last win32 and
possibly other platforms.
These already existed in testgesture.c so I removed them
from there also.
|
|
7e52722d
|
2014-06-20T11:10:16
|
|
Fix compiler warnings in Native Client and Linux builds.
|
|
553cc07e
|
2014-06-20T10:59:51
|
|
Initialize nacl_io, removes SDL_NaClMount/Umount
It's just easier to use nacl_io's mount/umount directly.
|
|
41a39837
|
2014-06-18T20:11:39
|
|
Add IBus IME Support, move DBus code to its own file. (v3.3 squashed)
|
|
175b343e
|
2014-06-15T17:37:35
|
|
Fixed bug 2568 - NO_SDL_GLEXT should prevent OS glext.h as well
J?rgen Tjern?
If you #define NO_SDL_GLEXT before including SDL_opengl.h, it still includes the platform-provided glext.h. The comments indicate that this define is intended to be used when you provide your own glext.h (quote from SDL_opengl.h: "Define this if you have your own version of glext.h and want to disable the version included in SDL_opengl.h.")
This is a problem because glext.h depends on the contents of gl.h, and it's practical to let SDL_opengl.h pick the right #include for gl.h for our platform.
|
|
efa2d058
|
2014-06-08T18:18:13
|
|
Fixes audio for Native Client, and other fixes...
- SDL_NaClMount, SDL_NaClUmount
- Default mounting of https at / in SDL's main function
- More documentation in README-nacl.txt
|
|
5ae12b46
|
2014-06-08T12:05:17
|
|
The NaCL mount/unmount functions need to be in SDL_system.h and specific to NaCL
|
|
2b95c4c4
|
2014-06-08T13:01:04
|
|
Fixed doxygen comment in header.
|
|
0ad1dc18
|
2014-06-08T12:51:02
|
|
Fixed typo in source comment.
|
|
6101e4b2
|
2014-06-07T18:20:01
|
|
Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
|
|
1e352d79
|
2014-06-06T15:45:59
|
|
Chrome's Native Client backend implementation
|
|
2d38a71a
|
2014-06-05T00:45:16
|
|
Added SDL_HITTEST_RESIZE_*, and implemented for X11.
|
|
b861efde
|
2014-06-05T00:03:33
|
|
Implemented SDL_GetAbsoluteMouseState().
X11 only for now, but this should be doable on every platform, I think.
|
|
1188c174
|
2014-06-04T16:35:07
|
|
Fixed Mac OS X build
|
|
da6d9a9f
|
2014-06-04T10:56:56
|
|
Added annotations to help code analysis tools
CR: Bruce Dawson
|
|
45ed5ee4
|
2014-06-04T10:55:26
|
|
Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal()
|
|
3e3b34ad
|
2014-06-04T10:52:34
|
|
Added a hint to disable windows message processing in SDL_PumpEvents()
SDL_SetHint( SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, "0" );
|
|
0d1f0fed
|
2014-06-04T10:50:32
|
|
Added a hint to disable window frame and title bar interaction when the cursor is hidden
|
|
d3418446
|
2014-06-04T10:33:23
|
|
SDL_opengl: Fix Mac build for SDK 10.9 too.
|
|
d623c0b4
|
2014-06-04T09:59:10
|
|
SDL_opengl: Fix Mac build with new glext.h
|
|
a2085da2
|
2014-06-04T01:35:36
|
|
SDL_opengles2: Update to latest Khronos headers.
This updates to the latest Khronos headers, which gives the latest
headers for MSVC.
The following files were retrieved on 2014-06-04:
http://www.khronos.org/registry/gles/api/GLES2/gl2.h
http://www.khronos.org/registry/gles/api/GLES2/gl2ext.h
http://www.khronos.org/registry/gles/api/GLES2/gl2platform.h
http://www.khronos.org/registry/egl/api/KHR/khrplatform.h
And they were modified to not include each other themselves.
|
|
0887f518
|
2014-06-04T01:32:52
|
|
SDL_opengl: Update to glext.h from Khronos dated 2014-05-21.
This updates to the latest glext.h from Khorons that includes the OpenGL
4.4 specification. It was retrieved from
http://www.opengl.org/registry/api/GL/glext.h at 2014-06-04.
|
|
f45a2fd0
|
2014-06-04T01:27:13
|
|
SDL_opengles2: Separate out GLES2 headers.
|
|
8793657d
|
2014-06-04T01:21:00
|
|
SDL_opengl: Move glext.h to a separate file.
|
|
32665131
|
2014-06-02T09:01:26
|
|
Added a way to get the native Android window and EGL context
|
|
7153c2da
|
2014-05-30T09:50:47
|
|
Fixed using SDL_PointInRect() from C++.
|
|
661548c8
|
2014-05-29T13:38:39
|
|
Tweaked hit-testing documentation.
|
|
98c03f39
|
2014-05-28T01:22:47
|
|
Changed drag area API to a hit-testing API.
There were several good arguments for this: it's how Windows works with
WM_NCHITTEST, SDL doesn't need to manage a list of rects, it allows more
control over the regions (how do you use rects to cleanly surround a circular
button?), the callback can be more optimized than a iterating a list of
rects, and you don't have to send an updated list of rects whenever the
window resizes or layout changes.
|
|
3cbc83ef
|
2014-05-27T01:27:42
|
|
First shot at SDL_SetWindowDragAreas().
Only Cocoa implemented right now.
|
|
b7f90442
|
2014-05-27T00:26:47
|
|
Added SDL_PointInRect().
|
|
b7d2c0e9
|
2014-05-24T01:30:37
|
|
Implemented SDL_CaptureMouse().
|
|
f5c77149
|
2014-05-18T21:05:39
|
|
Fixed typo in header comment.
|
|
81c574b8
|
2014-05-11T15:59:22
|
|
Fixed typo in header comment.
|
|
b701175a
|
2014-05-10T17:00:37
|
|
Include gl2platform.h in SDL_opengles2.h so we play nice with GLEW.
Based on feedback from Sven Bergstr?m
|
|
2a7aa9bd
|
2014-05-06T00:13:07
|
|
Fix build on Windows targets without dxgi.h, like MingW32.
|
|
548a0ee7
|
2014-05-05T22:21:26
|
|
__ANDROID__ is the correct macro to check for an android system.ANDROID is only defined in NDK build system (.mk) and not in the standalone NDK.
|
|
cb403ab6
|
2014-04-29T12:00:28
|
|
Removed comma at end of enum in a public header, to make -Wpedantic happy.
|
|
bd6a4936
|
2014-04-26T12:38:35
|
|
Fixed bug 2508 - don't redefine WIN32_LEAN_AND_MEAN
|
|
3cdae42d
|
2014-04-23T03:42:32
|
|
Fixing issues discovered by Philipp Wiesemann
|
|
ae2a50fc
|
2014-04-21T12:42:25
|
|
Revert MIR_CFLAGS to SDL_CFLAGS. Use forward declaration for the real fix. (We shouldn't expose mir headers!)
|
|
defd90b6
|
2014-04-19T13:15:41
|
|
Render: Allow empty cliprect.
This fixes an issue where an empty cliprect is treated the same as a NULL
cliprect, causing the render backends to disable clipping.
Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to
differentiate between:
- SDL_RenderSetClipRect(render, NULL)
- SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r);
Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504
|
|
03afd0de
|
2014-04-18T12:43:04
|
|
SDL_DXGIGetOutputInfo() checks input parameters and returns a boolean value whether or not it succeeded.
|
|
3dcb451f
|
2014-04-09T21:29:19
|
|
Added a README file regarding WinRT support
To note, this file is currently formatted with CRLF line endings, rather than
LF, to allow the file to be viewed with Notepad.
|
|
612f4a69
|
2014-04-07T21:20:39
|
|
inital apk extension support
|
|
a24745f4
|
2014-04-05T23:32:41
|
|
Fixed names of four hint environment variables.
|
|
9eccde51
|
2014-04-06T00:30:48
|
|
Enable building of Android libraries using a standalone NDK
|
|
aeebdc50
|
2014-04-05T23:22:21
|
|
Fixed typos in header comments.
|
|
02045dcb
|
2014-04-04T23:52:23
|
|
Fixed doxygen comment in header.
|
|
26823b1b
|
2014-03-23T23:09:22
|
|
Added an event SDL_RENDER_DEVICE_RESET, which is triggered on Direct3D 11 when the device has been lost and all textures need to be recreated.
|
|
b51a3206
|
2014-03-22T20:48:18
|
|
WinRT: Got OpenGL ES 2 working with the latest version of ANGLE/WinRT.
SDL/WinRT did have support for OpenGL ES 2 via an older version of ANGLE/WinRT,
however its API changed a few months ago, and SDL/WinRT would crash when trying
to use it. It would also occasionally crash when using the older version.
This changeset should make SDL/WinRT work with the latest version, as
available via MS Open Tech's git repository of it at
https://github.com/msopentech/angle
Older versions of ANGLE/WinRT (from either https://github.com/stammen/angleproject
or https://bitbucket.org/DavidLudwig/angleproject) will need to be updated to
MS Open Tech's latest version.
|
|
1496be6e
|
2014-03-18T12:08:49
|
|
Fixed a build error in SDL_platform.h when using Code Blocks and MinGW
winapifamily.h, a header file specific to Microsoft's Windows 8 SDK, wasn't
getting found, which was leading to a build error.
|
|
f9a58968
|
2014-03-13T21:21:26
|
|
Added missing copyright notices
|
|
7124034b
|
2014-03-12T23:44:23
|
|
Windows XP toolchain fix from Bruce Dawson:
Fix to allow using SDL when compiling with v110_xp or v120_xp -- compiling with VS2012/VS2013 with the XP targeting option.
In order to ensure that we can target Windows XP we compile with the v120_xp toolset instead of v120. This means that we use an earlier SDK version and it means that winapifamily.h is not available. Compiling for this old SDK can be detected using the _USING_V110_SDK71_ define which is set through the %(PreprocessorDefinitions) option.
|
|
b68b6e23
|
2014-03-12T11:57:15
|
|
Fixed various build and runtime errors when using WinRT with VS2012.
|
|
e99dc1f1
|
2014-03-10T19:11:52
|
|
Fixed binary compatibility with the new Windows RT support
|
|
7d98754a
|
2014-03-10T19:11:50
|
|
Temporarily disabled the D3D11 renderer so we can get a build.
|
|
1a35f32b
|
2014-03-10T01:51:03
|
|
Converted David Ludwig's D3D11 renderer to C and optimized it.
The D3D11 renderer is now slightly faster than D3D9 on my Windows 8 machine (testsprite2 runs at 3400 FPS vs 3100 FPS)
This will need tweaking to fix the Windows RT build.
|
|
e58ee540
|
2014-03-09T12:08:07
|
|
Fixed compiling with mingw64
|
|
1367bf87
|
2014-03-09T11:36:47
|
|
Integrated David Ludwig's support for Windows RT
|
|
05c23063
|
2014-03-09T11:06:11
|
|
Fixed line endings on WinRT source code
|
|
c167d1f6
|
2014-03-09T10:38:30
|
|
Updated SDL to version 2.0.3
|
|
9e67444a
|
2014-03-03T21:25:16
|
|
Mac: Added a hint to opt-out of new Spaces code.
|
|
51faf449
|
2014-03-02T12:45:51
|
|
Reworked fullscreen policy on Mac OS X.
- SDL_WINDOW_FULLSCREEN works as always (change resolution, lock to window).
- SDL_WINDOW_FULLSCREEN_DESKTOP now puts the window in its own Space, and
hides the menu bar, but you can slide between Spaces and Command-Tab between
apps without the window minimizing, etc.
- SDL_WINDOW_RESIZABLE windows will get the new 10.7+ "toggle fullscreen"
window decoration and menubar item. As far as the app is concerned, this is
no different than resizing a window, but it gives the end-user more power.
- The hint for putting fullscreen windows into the Spaces system is gone,
since Spaces can't enforce the requested resolution. It's a perfect match
for FULLSCREEN_DESKTOP, though, so this is all automated now.
|
|
63106e47
|
2014-03-01T12:21:15
|
|
Changed SDL_HINT_ACCEL_AS_JOY to SDL_HINT_ACCELEROMETER_AS_JOYSTICK to be more clear.
|
|
e56bbe3f
|
2014-02-28T14:23:41
|
|
Added a hint to enable the screensaver by default
|
|
af0ab490
|
2014-02-22T14:57:12
|
|
Fixed bug 2346 - Mac: mousewheel events have flipped horizontal scroll values
Alex Szpakowski
On my Mac OS X system (10.9.1), the SDL_MOUSEWHEEL event reports negative X values when my trackpad scrolls to the right, and positive X values when my trackpad scrolls to the left. This is backwards from what I'd expect, and I don't think it matches the Windows wheel events.
The vertical scroll values are what I'd expect though, and are consistent what gets reported on Windows (positive Y for scrolling up, negative Y for scrolling down.)
This is with "scroll direction: natural" disabled in the OS X trackpad settings (i.e. my scroll direction in non-SDL OS X programs matches what happens in Windows and Linux.)
I also tested with the horizontal scroll on a real mouse (Logitech G500 without custom drivers), and the horizontal scroll values in SDL are still flipped.
I "solved" the issue for myself by changing this line in the Cocoa_HandleMouseWheel function:
float x = [event deltaX];
to this:
float x = -[event deltaX];
I believe it should work fine with that change - I found something similar in another codebase while looking online for my issue - but I haven't tested on anything below Mac OS 10.8.
|
|
fbeb24e9
|
2014-02-16T00:04:15
|
|
Fixed documentation comments in SDL_hints.h file.
|
|
baf2dd4c
|
2014-02-13T11:05:34
|
|
Back out changelist 1951976
|
|
c52c9105
|
2014-02-13T11:05:30
|
|
Added SDL_DXGIGetOutputInfo which returns the adapter and output indices that are used to create DX10 and DX11 devices and swap chains on a particular display.
CR: SamL
|
|
1fa4939a
|
2014-02-13T11:05:24
|
|
Added SDL_GetLoadedModule to do the equivalent of GetModuleHandle/dlload(NOLOAD)
CR: Jorgen
|
|
ae05f178
|
2014-02-10T10:02:51
|
|
Recreate render target textures when the D3D device is being reset, and notify the application using the SDL_RENDER_TARGETS_RESET event when this happens.
|
|
9f2509da
|
2014-02-10T10:02:42
|
|
Exposed the font character size and SDLTest_DrawCharacter() to make it easier to do custom debug text layout
|
|
853334af
|
2014-02-09T03:09:56
|
|
Updated SDL to version 2.0.2
|
|
ba55cbef
|
2014-02-07T11:55:13
|
|
Make non-Clang compilers happy.
|
|
129456fe
|
2014-02-07T11:52:35
|
|
Tell Clang's static analysis that SDL_assert() is an assertion handler.
This lets it know, for example, that when you do this...
SDL_assert(ptr != NULL);
...that (ptr) is definitely not NULL at this point in the program, for the
sake of static analysis. While a buggy program could definitely trigger this
assertion, Clang assumes your assertion check is covering it and won't
report possible NULL dereferences after this point.
Since SDL_assert might continue if the user clicks "ignore", without this
change Clang would notice you checked for NULL (meaning that NULL is a real
possibility here) and still wrote code outside of that test branch that
dereferences the pointer, and thus would always trigger false positives.
Static analysis is fun!
|
|
7afbb8c3
|
2014-02-05T00:34:26
|
|
SDL_pixels.h needs SDL_stdinc.h for SDL_FOURCC #define (thanks, Dmitry!).
Fixes Bugzilla #2384.
|
|
c2b5da97
|
2014-02-04T11:38:40
|
|
Added SDL_GetAssertionHandler() and SDL_GetDefaultAssertionHandler().
|
|
89fd0faf
|
2014-02-03T11:52:54
|
|
Hooked up dynamic loading for Mir.
|
|
6bc29770
|
2014-02-02T23:53:48
|
|
Added some SysWM bits for Mir.
|
|
19f8c622
|
2014-02-02T23:41:46
|
|
Added Mir video target (thanks, Brandon!).
|
|
9ee68e8f
|
2014-02-02T20:55:42
|
|
Added additional platform check for __ANDROID__.
The macro ANDROID was deprecated with "android-ndk-1.6_r1".
|
|
58edac3e
|
2014-02-02T00:53:27
|
|
Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
|
|
3bd0e900
|
2014-02-02T00:33:31
|
|
Fixed bug 2376 - no SDL_HasAVX
Haneef Mubarak
AVX is the successor to SSE* and is fairly widely available. As such, it really ought to be detectable.
This functionality ought to be trivial to implement, and not having it means being forced to write an ugly workaround to check for AVX (so that normal SSE can be used if AVX is not available).
Here is an example on detecting AVX from SO (it actually shows ways to cehck for all of teh fancy instructions):
http://stackoverflow.com/questions/6121792/how-to-check-if-a-cpu-supports-the-sse3-instruction-set
|
|
d76c2cc1
|
2014-01-30T12:30:40
|
|
Add a new hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that allows SDL_CreateWindowFrom() to set the pixel format of another SDL_Window (and also will set the SDL_WINDOW_OPENGL flag on the window created with SDL_CreateWindowFrom()).
The reasoning behind this change is that source2 in -tools mode has a single OpenGL context that is used with multiple different windows. Some of those windows are created outside the engine (i.e. with Qt) and therefore we need to use SDL_CreateWindowFrom() to get an SDL_Window for those. The requirement for sharing an OpenGL context across multiple different windows is that each window has the same pixel format. To facilitate this, I now set SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT for the main window before calling SDL_CreateWindowFrom(). When I do this, SDL_CreateWindowFrom() will:
1. Set the pixel format of the returned window to the same pixel format as this SDL_Window passed in with the hint
2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.
I only currently implemented this for Win32/WGL so implementing it for other platforms (i.e. X11) remains a TODO.
CR: SamL
Some pseudocode that shows how this is used in Source2:
HWND hExternalHwnd; // HWND that was established outside of SDL
// Create main window (happens inside platwindow.cpp)
SDL_Window *mainWindow = SDL_CreateWindow( , SDL_WINDOW_OPENGL .. );
// Create GL context, happens inside rendersystemgl
SDL_GLContext onlyContext = SDL_GL_CreateContext( mainWindow );
// Now I need to create another window from hEternalHwnd for my swap chain that will have the same pixel format as mainWindow, so set the hint
SDL_SetHint( SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, CFmtStr( %p, mainWindow) );
// Create the secondary window. This returned window will have SDL_WINDOW_OPENGL set and share a pixel format with mainWindow from the hint
SDL_Window *secondaryWindow = SDL_CreateWindowFrom( hExternalHwnd );
// To render to the main window:
SDL_GL_MakeCurrent( mainWindow, onlyContext );
// Do some rendering to main window
// To render to the secondary window:
SDL_GLMakeCurrent( secondaryWindow, onlyContext );
// Do some rendering to secondary window
|
|
338bf9cc
|
2014-01-29T18:38:13
|
|
Add SDL_GL_ResetAttributes.
|