// LoadFunctions - Attempt to retrieve all used OpenGL functions, returns true if all of them were retrieved or false if there is a single failure
bool CGLManager::LoadFunctions( void )
{
if ( !(GetAnyGLFuncAddress( "glBegin", &gGL.glBegin )) )
return false;

Here's how my manager work in general : it first check which renderer the game's engine uses (Software, OpenGL or Direct3D), if it's not OpenGL, then we stop getting any further. Otherwise, we load the library (

opengl32.dll

or

libGL.so

) and we check if it's good or not (again, if failed, we stop), we retrieve and store the pointers to OpenGL's functions (

glBegin

,

glEnd

,

glVertex3f

) with the

LoadFunctions

method and we return if everything's fine or something wrong happened.

Now the problem : the

GetAnyGLFuncAddress

method retrieve successfully OpenGL functions (in other words,

glBegin

will return true,

glARandomMethodThatDontExist

will return false) but for some reason,

gGL.glBegin

(and it's "friends") in

LoadFunctions

doesn't get updated and it will be always NULL causing a crash.

I have been trying for hours to find out a solution by searching on Internet and on StackOverflow but I haven't found any answer that can give me the solution to the problem.

In many websites and answers I've found on StackOverflow, a lot of people suggested to use an OpenGL loading library like GLEW and even the OpenGL wiki recommend it. However, due to the nature of the environment I'm working on, I can't use those kind of libraries and neither I can't use OpenGL functions directly, I know I'm going through the painful way by doing everything manually but I have no other choice.

You're passing the address in the second argument, but inside the function GetAnyGLFuncAddress, you're not updating the value so that the new value is reflected back to the caller. You're setting the local value instead, thus gGL.glBegin (and all the other addresses from the other two calls), will not be set.