[fpc-pascal] OpenGL and SDL frustrations
Ryan Joseph
ryan at thealchemistguild.com
Thu May 25 09:42:20 CEST 2017
> On May 25, 2017, at 2:30 PM, Anthony Walter <sysrpl at gmail.com> wrote:
>
> 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);
>
That’s just a hint to SDL but it doesn’t guarantee anything. See my example below where I asked for 3.3 but got 4.1. I learned I can use a lower version of GLSL so I can enforce that version but for OpenGL I’m stuck on 4.1 or 2.1, at least on my Mac. That wouldn’t be a problem I guess but I’m trying to follow tutorials which have subtle things not work but I’m not using the same version as them. Maybe it doesn’t matter though and 4.1 will run on older graphics cards? No idea but it’s worrying.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list