SDL 2.0.3 - OpenGL ES on Windows 8.1 (using angle) |
Anorian
|
Hi all
First of: I am not sure this is the correct place for an error/help request like this. If its not, I apologize ( I tried to register on the SDL forum to post it there but that wont allow me to post at all for some reason). If this is the wrong place however, please just disregard the following. Summary: I am having trouble getting the combination of SDL 2.0.3 and OpenGL ES on Windows 8.1 (using angle) to work. SDL_Init, window creation and ogl context creation seem to work fine but whenever I call glCreateShader(GL_VERTEX_SHADER) I get an error (0) returned. Long version: Porting a project from using SDL 2.0.3 and OpenGL on windows to OpenGL ES 2.0 in preparation for supporting Android. I've extracted the major steps that lead to the problem into a little program that reproduces the error. Maybe someone here can spot where I am going wrong (or maybe its a bug?) // ---------------------------------------------------------------------------------------------------------------------- #include <SDL.h> #include <SDL_opengles2.h> int main(int argc, char *argv[]){ int ret = SDL_Init(SDL_INIT_VIDEO); if (ret != 0) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SDL_Init Error", SDL_GetError(), NULL); ret = SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1); ret = SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); ret = SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); ret = SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_Window *screen = SDL_CreateWindow("SDLGLTEST", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_OPENGL); SDL_GLContext ctx = SDL_GL_CreateContext(screen); if (ctx == NULL) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SDL_GL_CreateContext Error", SDL_GetError(), NULL); GLuint shader = glCreateShader(GL_VERTEX_SHADER); if (shader == 0) SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "glCreateShader Error", "glCreateShader() returned 0", NULL); return 0; } // ---------------------------------------------------------------------------------------------------------------------- This is compiled on Windows 8.1 using Visual Studio Express 2013. Its linked against: SDL2.lib; SDL2main.lib;libEGL.lib;libGLESv2.lib; I've tried both, the angle .dll files from my Chrome install and the ones compiled from the latest source) The program seems to work fine up to the glCreateShader call (which returns 0) every time. Any help / ideas greatly appreciated. Regards Gerhard _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
SDL 2.0.3 - OpenGL ES on Windows 8.1 (using angle) |
Anorian
|
Hi
Resolved this now. Turns out I was _not_ using the angle libs afterall. Since my opengl32.dll (nvidia) contains the required support for an ES profile, SDL just used that one. (I was under the , wrong, assumption that since I was linking against the project angle libs and also because my test app would not load when the respective .dll files were missing that I was infact using the angle libs) Well, I was not and the nvidia provided opengl32.dll, being nicecly conformant with the standard, does not load stuff like glCreateShader() by default. You have to manually do that. Adding the following solved the problem nicely: typedef GLuint (APIENTRY * GL_CreateShader_Func)(GLuint); GL_CreateShader_Func glCreateShader = 0; glCreateShader = (GL_CreateShader_Func)SDL_GL_GetProcAddress("glCreateShader"); Sorry for the unneeded post, should have been more thorough before posting it here (but maybe at least someone else can benefit from the finding ) Regards Gerhard Am 11.04.2014 20:06, schrieb Anorian:
_______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Re: SDL 2.0.3 - OpenGL ES on Windows 8.1 (using angle) |
Re: SDL 2.0.3 - OpenGL ES on Windows 8.1 (using angle) |
DLudwig
|
SDL's Win32 backend allows a different OpenGL .dll file to be loaded via use of the SDL_OPENGL_LIBRARY environment variable. This can be set by a program, via use of SDL's SDL_setenv function (declared in SDL_stdinc.h). I hope this helps! -- David L. |
|||||||||||||
|