[fpc-pascal] OpenGL and SDL frustrations

Anthony Walter sysrpl at gmail.com
Thu May 25 09:49:12 CEST 2017


Oh and another note, you cannot load your gl function such as (glClear in
my previous reply, this time I use glGenTextures):

var glGenTextures: procedure(n: GLsizei; var textures: GLuint); cdecl;

Until you create and make current your OpenGL context.
SDL_GL_MakeCurrent(window, context); // after this is done the first time
you can then load the OpenGL functions matching your requested version

So the order is

SDL_Init()
SDL_GL_SetAttribute() multiple times
SDL_CreateWindow() returns your window
SDL_GL_CreateContext() returns your context
SDL_GL_MakeCurrent() makes gl functions available
SDL_GL_GetProcAddress() for every gl function in your requested version

Then you are done initializing everything and can write a
game/demo/whatever thing you want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170525/c14e3866/attachment.html>


More information about the fpc-pascal mailing list