Jump to content
  • Advertisement
Sign in to follow this  

OpenGL across DLLs

This topic is 4375 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, I have written a wrapper for OpenGL in order to stay API independent. Now I am pretty new to working with dlls, so I wonder if I can simply use the wrapper in the dll code as well or do I have to export the wrapper functions? Does this cause any rendering context problems if I just use the wrapper in the dll? The wrapper functions are encapsulated in a namespace and just call the gl functions .

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I built something that sounds quite similar.

I have an executable which linked with a graphics engine DLL. The executable then invoked another DLL that contained a graphics demo or game for example.

I had to place the window creation code (incl. OpenGL context creation) in the executable. I think there are ways around this (i.e. so I _could_ have created the window in the DLL) but they are platform specific.

The graphics engine DLL contained a bunch of classes that called OpenGL functions as usual (e.g. Font, Texture, Terrain). I did not have any problems with context. You have to be careful to export your functions/classes correctly from the DLL and import them correctly in the executable and demo/game DLLs.

(I did the last part with preprocessor magic, such that symbols such as GAME_ENGINE_IMPORT or GAME_ENGINE_EXPORT were defined in the project settings to determine if symbols were imported or exported). See MSDN/Google for examples.

Sorry I cannot give you a more concrete example but I do not have my code to hand.

Hope that helps,
dhm

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!