diff options
author | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-12-01 11:16:36 +0000 |
---|---|---|
committer | icculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-12-01 11:16:36 +0000 |
commit | 90bf7c94bc7814ef7c9dc7c24c601b867c953e2e (patch) | |
tree | b435cb6fc3c36c2a71a3448a33f743a8a1825a6f | |
parent | a986fb4d42e5ab71bdee791aff141e97065e83c9 (diff) | |
download | ioquake3-aero-90bf7c94bc7814ef7c9dc7c24c601b867c953e2e.tar.gz ioquake3-aero-90bf7c94bc7814ef7c9dc7c24c601b867c953e2e.zip |
r_smp now works as expected with sdl_glimp.c on Mac OS X.
git-svn-id: svn://svn.icculus.org/quake3/trunk@397 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r-- | code/unix/sdl_glimp.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c index 3960984..b435d8a 100644 --- a/code/unix/sdl_glimp.c +++ b/code/unix/sdl_glimp.c @@ -75,6 +75,20 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "unix_glw.h" + +/* Just hack it for now. */ +#ifdef MACOS_X +typedef CGLContextObj QGLContext; +#define GLimp_GetCurrentContext() CGLGetCurrentContext() +#define GLimp_SetCurrentContext(ctx) CGLSetCurrentContext(ctx) +#else +typedef void *QGLContext; +#define GLimp_GetCurrentContext() (NULL) +#define GLimp_SetCurrentContext(ctx) +#endif + +static QGLContext opengl_context; + #define WINDOW_CLASS_NAME "Quake III: Arena" #define WINDOW_CLASS_NAME_BRIEF "quake3" @@ -637,6 +651,8 @@ static int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen ) continue; } + opengl_context = GLimp_GetCurrentContext(); + ri.Printf( PRINT_ALL, "Using %d/%d/%d Color bits, %d depth, %d stencil display.\n", sdlcolorbits, sdlcolorbits, sdlcolorbits, tdepthbits, tstencilbits); @@ -1081,7 +1097,7 @@ static int GLimp_RenderThreadWrapper( void *arg ) glimpRenderThread(); - //qglXMakeCurrent( dpy, None, NULL ); + GLimp_SetCurrentContext(NULL); Com_Printf( "Render thread terminating\n" ); @@ -1090,6 +1106,17 @@ static int GLimp_RenderThreadWrapper( void *arg ) qboolean GLimp_SpawnRenderThread( void (*function)( void ) ) { + static qboolean warned = qfalse; + if (!warned) + { + Com_Printf("WARNING: You enable r_smp at your own risk!\n"); + warned = qtrue; + } + +#if !MACOS_X + return qfalse; /* better safe than sorry for now. */ +#endif + if (renderThread != NULL) /* hopefully just a zombie at this point... */ { Com_Printf("Already a render thread? Trying to clean it up...\n"); @@ -1146,7 +1173,7 @@ void *GLimp_RendererSleep( void ) { void *data = NULL; - //qglXMakeCurrent( dpy, None, NULL ); + GLimp_SetCurrentContext(NULL); SDL_LockMutex(smpMutex); { @@ -1164,7 +1191,7 @@ void *GLimp_RendererSleep( void ) } SDL_UnlockMutex(smpMutex); - //qglXMakeCurrent( dpy, win, ctx ); + GLimp_SetCurrentContext(opengl_context); return data; } @@ -1179,12 +1206,12 @@ void GLimp_FrontEndSleep( void ) } SDL_UnlockMutex(smpMutex); - //qglXMakeCurrent( dpy, win, ctx ); + GLimp_SetCurrentContext(opengl_context); } void GLimp_WakeRenderer( void *data ) { - //qglXMakeCurrent( dpy, None, NULL ); + GLimp_SetCurrentContext(NULL); SDL_LockMutex(smpMutex); { |