PDA

View Full Version : Cocoa and OpenGL entry points?


napthali
2003.12.13, 12:05 PM
I'm trying to implement volumetric fog in my application, but I can't seem to work the GL extension entry points properly.

I've tried adapting NeHe's Lesson 41 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=41) using this technote from Apple (http://developer.apple.com/qa/qa2001/qa1188.html), but I keep getting linking errors with multiple definitions of NSGLGetProcAddress and pfglFogCoordfEXT (which is what I'm calling the function), even adding "#ifndef ... #endif"'s for good measure.

Am I going about this the entirely wrong way? Is there a better way to do volumetric fog? If this is indeed the best way, how can I get around this entry point problem?

DoG
2003.12.13, 08:47 PM
Originally posted by napthali

Am I going about this the entirely wrong way? Is there a better way to do volumetric fog? If this is indeed the best way, how can I get around this entry point problem?

You could do volumetric fog the hard way, without that gl extension, but its definitely not better.

Why do you need the function pointers?

Check what frameworks you are binding to, its definitely some funky linking stuff going on.

OneSadCookie
2003.12.13, 10:43 PM
You don't need to dynamically load extension function pointers on the Mac. Just call the functions as you would any normal GL function.

napthali
2003.12.14, 04:42 AM
OneSadCookie, could you elaborate a bit? Can I just call glFogCoordfEXT()? No specific headers need to be included?

If I'm interpreting that right, score one for Apple Dev Tools. ;)

OneSadCookie
2003.12.14, 05:38 AM
You need to include <OpenGL/glext.h>, but yep, then you can just call glFogCoordEXT (of course, check for extension support first, or suffer the consequences)...

It's both a good thing and a bad thing. I think these days, I lean more towards bad... but that rant's for another thread and another day ;)

AnotherJake
2003.12.31, 09:22 PM
Hey napthali, let us know if you manage to get lesson 41 going. I tried a few months ago without success (didn't spend much time trying though, stupid priorities). GL volumetric fog would be real groovy to play around with.