Tuesday, January 24, 2017

Where did my shader go?


If you for the world can't figure out why a shader won't bite. Try checking that you are not trying to use a version that is not supported on your computer.

#version 450 core

On my computer, any shader with that line doesn't load. And the

GL.CompileShader(fragmentShader);

doesn't provide any feedback on what could be wrong.
After an hour of trying to figure out what was wrong I finally looked at what version of OpenGL that actually was running by the following line in the GameWindow constructor:

Title += "dreamstatecoding.blogspot.com: OpenGL Version: " + GL.GetString(StringName.Version);

Turned out I was running OpenGL Version: 4.4.0 - Build 21.20.16.4534.
So I changed the version in the shader to

#version 440 core

and all of a sudden the shaders kick in.

Update 2017-01-28
Turns out that I was using my built in Intel chip and not the NVidia when running my game window. After changing to NVidia, the 450 core version started to work as well.

Hope this helps someone out there :)

No comments:

Post a Comment