[fpc-pascal] OpenGL and SDL frustrations

noreply at z505.com noreply at z505.com
Fri May 26 06:56:29 CEST 2017


On 2017-05-23 22:13, Ryan Joseph wrote:
> I’ve wasted so much time on this I just need to stop and ask for help
> already. Over the last few years I’ve been picking away at OpenGL and
> only ever got the legacy 2.x API to work which has been fine for
> making 2D games but I wanted to at least learn the modern API and
> shaders.

Not sure what ZenGL uses for opengl version but why do you struggle to 
use opengl directly instead of using a wrapper like zengl that has 
already made the functions available for you...

The only problem with using a wrapper like zengl or andorra is that of 
course it could go stale and not be updated, I'm not even sure if it 
uses 2.x, I have forgotten.

[...]
> if SDL_Init(SDL_INIT_VIDEO) < 0 then
> 	Fatal('SDL could not initialize! '+SDL_GetError);
> 
> // load function pointers
> if Load_GL_VERSION_3_3 = false then
> 	Fatal('OpenGL is not loaded');
> 
> SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 
> SDL_GL_CONTEXT_PROFILE_CORE);
> // NOTE: 4.0 doesn't work, GL_VERSION return null
> SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
> SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
> SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
> SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
> 

All these calls look kind of tedious, instead of using a wrapper. But 
maybe you want to learn opengl at its heart and not use a wrapper.. and 
learn all the fine details the hard way (full respect for that).



More information about the fpc-pascal mailing list