![]() ![]() Dynamic-link library or DLL is the same with the EXE or executable files, which allow different software programs like printing documents from two different programs – Microsoft Word and Adobe Acrobat for example – to perform the same functions. Open Audio Library or OpenAL is a cross-platform audio application programming interface (API). The only reason to load all OpenGL symbols through GetProcAddress is if you load opengl32.dll with LoadLibrary or libGL.so with dlopen.In the middle of using a laptop or a desktop, there will be errors, and fortunately, there are ways to figure out the error message even if it seems too technical. wglGetProcAddress is exported alongside OpenGL-1.1 functions as is glXGetProcAddress exported alongside all OpenGL-1.2 functions (at least), so if your program sees the *GetProcAddress functions it also sees the other OpenGL functions. In general if your program binary is directly linked to the API library (stub) (in contrast to using a loader that loads the API library (stub) at runtime, dynamically), it's quity silly to retrieve functions being part of the OS's OpenGL ABI contract with *gl*GetProcAddress as these function are available through the regular API library anyway. It is not required that it returns addresses for functions found in the operating systems OpenGL ABI requirements (OpenGL-1.1 for Windows, OpenGL-1.2 for Linux Softare Base (LSB) 4, OpenGL-2.1 for LSB-5). *gl*GetProcAddres is specified only for returning entry point addresses for extended functionality. No more void * (except for the return value of wglGetProcAddress, which is casted). Since the type is now FnPtr*, whatever you pass in will automatically have FnPtr be of that type. *_pFunc = reinterpret_cast(wglGetProcAddress( _cName )) _pFunc = (void *)wglGetProcAddress( _cName ) // īool CGLManager::GetAnyGLFuncAddress( const char *_cName, FnPtr* _pFunc ) Let's cut out all of the code that is irrelevant and focus on this: bool CGLManager::GetAnyGLFuncAddress( const char *_cName, void *_pFunc ) ![]() 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.įorgetting about what your ultimate goal is, I see basic C++ mistakes. 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. 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. 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. 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. 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. If ( !(GetAnyGLFuncAddress( "glVertex3f", &gGL.glVertex3f )) ) If ( !(GetAnyGLFuncAddress( "glEnd", &gGL.glEnd )) ) If ( !(GetAnyGLFuncAddress( "glBegin", &gGL.glBegin )) ) LoadFunctions - Attempt to retrieve all used OpenGL functions, returns true if all of them were retrieved or false if there is a single failure ![]() ![]() _pFunc = (void *)glXGetProcAddress( _cName ) _pFunc = (void *)glXGetProcAddressARB( _cName ) According to some websites, NVIDIA drivers prefer the ARB implementation over the core one _pFunc = (void *)GetProcAddress( m_hLib, _cName ) _pFunc = (void *)wglGetProcAddress( _cName ) GetAnyGLFuncAddress - Attempt to retrieve the OpenGL function named "_cName" and store it in "_pFunc", returns true if success or false otherwiseīool CGLManager::GetAnyGLFuncAddress( const char *_cName, void *_pFunc ) Void (APIENTRY *glVertex3f)( GLfloat x, GLfloat y, GLfloat z ) Īnd here's the source : extern CGLManager gGL I have some trouble retrieving and storing manually the pointers to OpenGL functions, here is a "simplified snippet" version of my code : #ifdef WIN32īool GetAnyGLFuncAddress( const char *_cName, void *_pFunc ) ![]()
0 Comments
Leave a Reply. |