Jump to content
  • Advertisement
Sign in to follow this  
roos

OpenGL Extensions woes

This topic is 4767 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Sorry, I know this must be the #1 noob question asked here... Alright, so I have the source code of an OpenGL demo that uses multitexturing extensions. However when I compile, I get: unresolved external symbol glActiveTextureARB unresolved external symbol glMultiTexCoord2fARB The weird thing is, I thought if you wanted to use extensions, you have to get a pointer to the function you want to use. However, the author of the code seems to be merrily calling the function directly in his code, and when I try to do the same, it doesn't work. Btw he is developing on Linux and I am dev'ing on Windows, if that makes any difference. So, basically is there any way to get his code to compile as-is without changing any code? Maybe there is some version of the OpenGL .lib files that would fix the problem? Thanks roos

Share this post


Link to post
Share on other sites
Advertisement
You can't just do that, you need to load in the function pointer using a function. You're probably using Windows, so it'd most likely be wglGetProcAddress. Check out that function, if you're using SDL, it'll be SDL_GL_GetProcAddress.

Share this post


Link to post
Share on other sites
Quote:
Original post by roos
However, the author of the code seems to be merrily calling the function directly in his code, and when I try to do the same, it doesn't work. Btw he is developing on Linux and I am dev'ing on Windows, if that makes any difference.


Windows ships with OpenGL 1.1, so calling extensions or functions that have been added since 1.1 is a bit more difficult in windows.

I'd recommend taking a look at GLee (The OpenGL Easy Extension library). It's really easy to use.

Share this post


Link to post
Share on other sites
Those functions are in the core now. On everywhere but Windows the implementation is usually much more up to date. Those aren't extensions anymore they are in the core and if you had an updated GL you wouldn't need to load them. But we on Windows must persist until next gen windows (which is updated to 1.4).

Share this post


Link to post
Share on other sites
You can also use special header files from NVIDIA SDK (glh_extensions.h and glh_genext.h). But you will have to initialize all ext functions that your app is using somewhere. It seems that it should also work on Linux, but don't get my word on it.

Chris

Share this post


Link to post
Share on other sites
Bummer... Alright then, say I'm not using SDL, then is there any cross platform way to load extensions which doesn't need an external library like GLee or GLEW?

You might say why not just use GLee or GLEW, but I checked their pages and it looks like neither of them support MacOS X, which we're targeting as well as Windows and Linux.

Thanks

roos

Share this post


Link to post
Share on other sites
One could argue that adding a cross platform library like SDL would be a good thing(TM) then.

But if you want to clutter your code with #if defined(WINDOWS) ... #elif defined(LINUX) ... #elif defined(MACOSX), you can reuse most of the approach that I used in A small tip for getting all glFunctions.... You could either get all functions or just choose to get a couple, then put them in gl_functions.h using the same style.

Instead of SDL_GL_GetProcAddress, use different functions depending on the system you're compiling for.

Share this post


Link to post
Share on other sites
Cool, I guess I'll go with SDL then. Thanks a lot for the info guys, that definitely cleared up a lot of things.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!