LWJGL Forum

Programming => OpenGL => Topic started by: floyd on August 11, 2011, 06:47:40

Title: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 11, 2011, 06:47:40
I have a graphics card with OpenGL 4.1, and I tried loading shaders using GL20.glCreateShader(GL20.GL_VERTEX_SHADER); but I got a nullpointerexception in GL20 line 220, so I switched to ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB); and got a nullpointerexception on line 91 of ARBShaderObjects. Is there some other way I could create the shaders?

I can't create fragment shaders either.
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 11, 2011, 06:49:01
Oops, I put my email in the username field   :-[
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: kappa on August 11, 2011, 09:02:36
Quote from: floyd on August 11, 2011, 06:49:01
Oops, I put my email in the username field   :-[
I've renamed your username to just floyd, however SMF requires you change your password, you'll be emailed a new one (can change it back if you like).
Title: RE: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 11, 2011, 09:09:13
Thank you :)

I looked at the source and the nullpointers coming from glcontext.getCapabilities();
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 11, 2011, 20:28:20
Any ideas? I'm running it on a radeon hd 6870 (gl 4.1) and I tried it on my laptop which has some nivdia card, and I'm still getting the nullpointer inside lwjgl. I downloaded a nightly build and it did the same thing.
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: spasi on August 11, 2011, 21:39:04
Sounds like you don't have a context current in the thread that's calling these OpenGL functions.
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 12, 2011, 02:46:25
I thought lwjgl managed the context?
Title: Re: Can't initialize shaders in GL20 or using ARB
Post by: floyd on August 12, 2011, 08:22:23
Quote from: spasi on August 11, 2011, 21:39:04
Sounds like you don't have a context current in the thread that's calling these OpenGL functions.

OOOHHHH! I misread that! I was accidentally loading the shaders in my constructor instead of the way I needed to.
I was going to give up if I couldn't get it to load, so thank you very, very much.