| Summary: | OpenGL: unresolved glActiveTexture() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | igor <mansonigor> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
Ryan, can you look at this for 2.0.5? (In reply to Sam Lantinga from comment #1) > Ryan, can you look at this for 2.0.5? yep! --ryan. Code, on which you can test issue has been moved here https://github.com/dorkster/flare-engine-next Rereading this bug report, this isn't actually an SDL bug. You're redefining an OpenGL symbol as something else. glActiveTexture is meant to be a function (even if it happens to not be listed in opengl32.dll), but your program is redefining it to be a function pointer, so this upsets the compiler since it saw a our previous definition. If you want to load a function pointer from OpenGL with SDL_GL_GetProcAddress (or wgl or glX directly), you should pick a different name: PFNGLACTIVETEXTUREARBPROC pglActiveTextureARB; // note the 'p'. Failing to do this will absolutely cause you problems on other platforms--if not on Windows too--when the dynamic loader ends up with a variable from your app where it thought it was getting a function in a DLL or vice versa. --ryan. |
glActiveTexture() is not present in Windows version of opengl32.dll In 2.0.3 it was possible to declare and define it using: extern PFNGLACTIVETEXTUREARBPROC glActiveTexture; PFNGLACTIVETEXTUREARBPROC glActiveTexture = NULL; glActiveTexture = (PFNGLACTIVETEXTUREARBPROC) glGetProcAddressARB("glActiveTextureARB"); by using external glext.h rev: Khronos $Revision: 28986 $ on $Date: 2014-11-18 18:43:15 -0800 (Tue, 18 Nov 2014) $ and in code: #define NO_SDL_GLEXT #include <SDL_opengl.h> #include "glext.h" Using internal glext caused linker error with glShaderSource() in current 2.0.4 version (08 Oct 2015) it doesn't work with neither built-in or external glext.h It causes unresolved symbol when you not declare/define glActiveTexture() manually (because Windows lacks definition), or causes redefinition when you define/declare it by getting processAddress. Removing GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); line from SDL2_opengl.h fixes issue under Windows, I can use both internal and external glext.h, manual definition works fine, but I have no idea how it will influence other platforms. After looking into code a little looks like some defines have changes inside SDL_opengl.h which introduced this issue (but fixed issue with internal glext and glShaderSource) You can test issue on next code https://github.com/igorko/flare-engine/tree/openGL