You need to tell SDL what OpenGL kind and version before you create a window. For example if you want OpenGLES 2.0 you would write:
SDL_Init(SDL_INIT_VIDEO); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); If you want normal OpenGL 4.0 you would write: SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); Then you can create the SDL and load the appropriate OpenGL function prototypes using: glClear := SDL_GL_GetProcAddress('glClear'); It's up to you to know which functions are part of which which OpenGL spec, and you should need to load the functions dynamically to stubs: var glClear: procedure(mask: GLbitfield); cdecl; Don't forget, if you want a specific values for stencil bits, pixel order, multisampling levels and other stuff, you need to set those values before you create a window. Check the return values of SDL_CreateWindow and SDL_GL_CreateContext to see if anything above fails, for example the target device doesn't support OpenGL 4.0. SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8); // 8x anti-aliasing, must be called before SDL_CreateWindow SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 16); // 16 bit stencil buffer, must be called before SDL_CreateWindow
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal