SDL and aglGetCurrentContext()

Quoting a message Re: Mac OS X - 1.2.9 stable - Errors and
aglGetCurrentContext(), Oct. 8, 2005 by Martin Storsj?:

The second part of my question is still a mystery – I need to get the
AGLContext that SDL is using (this is on Mac OS 10.4.2, SDL 1.2.9). I
know it’s hidden in the data structures somewhere. Is there a way to
coax it out? aglGetCurrentContext() always returns null under SDL.

I have the same problem here - aglGetCurrentContext() gives me 0, no
matter where I call it. Is there any way to solve this?

Actually, I’m trying to use AGL_SWAP_INTERVAL to activate vblank syncing
under Mac OS X. I’ve looked at what
https://bugzilla.libsdl.org/show_bug.cgi?id=117 does, and it’s a (cool)
step in the right direction, but I’d like the ability to wait for more
than one vblank interval - essential, for instance, for video playback
at exactly 30 Hz without tearing. I’ve got this running in an SDL app
under linux using glXWaitVideoSyncSGI, and it looks great :-).

Anyway, I’d dig into the SDL code myself and/or patch it if that were
nessesary if somebody would point me in the right direction.

Regards,

Uli

Ulrich von Zadow wrote:

I’d like the ability to wait for more than one vblank interval -
essential, for instance, for video playback at exactly 30 Hz without
tearing.

You’ll be able to do that (in a platform-independent way) using the
patch at https://bugzilla.libsdl.org/show_bug.cgi?id=2. It doesn’t
include an implementation for Mac OS X yet, but I plan to supply one as
soon as it goes into CVS, as a replacement for my patch (Bug #117).

I have the same problem here - aglGetCurrentContext() gives me 0, no
matter where I call it. Is there any way to solve this?

There’s an NSOpenGLContext in current_video->hidden->gl_context, but I’m
not sure if current_video is accessible from an application. I assume
you can get hold of the NSOpenGLContext using [NSOpenGLContext
currentContext] and of the underlying CGLContext using
CGLGetCurrentContext(), but I’ve never tried it. I don’t think there’s
an AGLContext around (AFAIK AGLContext and NSOpenGLContext build on
CGLContext independently of each other).

-Christian

Thanks, that looks like exactly what I need. Any idea when the patch will have
made it? (No particular hurry, just checking).

Cheers,

Uli

Christian Walther wrote:> Ulrich von Zadow wrote:

I’d like the ability to wait for more than one vblank interval -
essential, for instance, for video playback at exactly 30 Hz without
tearing.

You’ll be able to do that (in a platform-independent way) using the
patch at https://bugzilla.libsdl.org/show_bug.cgi?id=2. It doesn’t
include an implementation for Mac OS X yet, but I plan to supply one as
soon as it goes into CVS, as a replacement for my patch (Bug #117).

Thanks, that looks like exactly what I need. Any idea when the patch will have
made it? (No particular hurry, just checking).

It’s on the list for evaluation for 1.3, no ETA though (I’m busy making
sure the current code in CVS builds for all existing platforms.)

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment