[fpc-pascal] OpenGL and SDL frustrations

Ryan Joseph ryan at thealchemistguild.com
Wed May 24 17:29:03 CEST 2017


> On May 24, 2017, at 7:18 PM, Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:
> 
>> Any ideas on what’s wrong with this?
> 

Ok, I got an answer from a person on YouTube and figured this out.

The problem was 1) that SDL is returning a different version then I asked for and I didn’t do proper error checking. glEnableVertexAttribArray was failing for example because with OpenGL 4.1 (or earlier) a VAO is required before using VBO’s and 2) again, since 4.x, a shader is required to even draw white triangle. The demos I saw must have been on some version of 3.x but I was on 4.1.

I’m still now sure how to guarantee SDL returns the version I want and it looks in your code you didn’t even try to specify anything besides core compatibility, not that it makes any difference because I always get 4.1 on my Mac or 2.1 and GLSL 1.2 for legacy mode. This begs the question of how I can write shaders if on any given computer I get a different version of GLSL.

At least I got it working FINALLY after so much hassle but everything I do could easily break on others computers so...

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list