OpenGL Functions in game.dll versus Win32.exe

Good evening everyone,

I'm currently only up to Episode 163, but have watched a few of Casey's later OpenGL episodes. What I'm curious is if there is anyway to share a GLEW or even custom global variable setup pointing to the driver OpenGL functions from the Win32 .exe to the Game .dll to call all the OpenGL calls (glBindBuffer, glShaderProgram) outside of the platform specific layer?

Setting up global variables pointing to the opengl functions didn't seem to work in the DLL, I suspect I would need some time of declspec export?

Trying with glew, initializing glew in the Win32 exe didn't export all the functions to the dll.

Is the only way to achieve this is have all the openGL calls in his opengl.cpp included on the Win32 side as Casey has setup?

Thanks in advance.
add them to the parameters of GameUpdateAndRender
Thanks ratchetfreak, that seems to be working perfectly.

Created an OpenGLAPI struct and put an instance in the EngineMemory that gets passed through an update and render style call to the DLL.

Not looking forward to all the defines and function prototypes I'll need to make (GL_VERTEX_SHADER, GLenum, etc.) to do this properly ;)

Curious what others are doing if you don't mind sharing.
Interesting! I thought about this question recently. I am also curious about how people achieve it.
Generating a loader using https://bitbucket.org/alfonse/glloadgen/wiki/Home and calling ogl_LoadFunctions() every time the DLL is reloaded should work. Even if the loading fails when it can't load all the functions/extensions, it will load all the function pointers it can.

Edited by Jeroen van Rijn on Reason: fix url