[GEM-dev] HaveValidContext + AGL
james tittle
tigital at mac.com
Mon Jan 30 17:15:45 CET 2006
hi IO,
On Jan 30, 2006, at 10:40 AM, IOhannes m zmoelnig wrote:
> i am currently skipping through the code and trying to replace pre-
> processor checks by runtime checks.
>
> i see a lot of references to HaveValidContext() in __APPLE__.
> i think some of them are obsolete or leftovers.
...this is necessary currently in order to prevent GEM crashing when
making gl calls without a context (ie. before a window is
created)...this usually happens when using media that isn't
loaded...apple has a strict interpretation of opengl, so it doesn't
allow gl commands to be silently ignored...
...the good news is that while working recently on the
multiple_windows branch, I came up with a way to initialize a "master
context" at GemMan::initGem(), which creates a minimal gl context
that is never directly associated with a glwindow, but instead is
shared when creating actual windows (and their associated
context)...this removes the need for the HaveValidContext() stuff
altogether, plus it allows sharing of resources between contexts (so
it's easier to swap things back and forth between offscreen &
onscreen contexts)...
...the bad news is that I haven't committed it to cvs: will try to
get that today...
> what bothers me a bit is, that whenver HaveValidContext is used,
> there is also an include for <AGL/agl.h>.
> is this necessary or is it just a copy'n'paste leftover?
> (i think there is nothing special in most of these files which
> would require AGL)
...yeh, that's mostly just cut n'paste: <AGL/agl.h> only needs one
inclusion...
> also i noticed that <Carbon/Carbon.h> and <AGL/agl.h> are included
> using the #import directive, which i think is ugly.
> are these 2 files save to include more than once?
...yes, they're safe...#import is really supposed to be for obj-c,
but it as far as I know it's equivalent to #include in the eyes of
gcc when doing non-obj-c code...
...so to sum up: you're finding a lot of archeology of my "beginning
to learning to code"...enjoy!
jamie
More information about the GEM-dev
mailing list