LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: jbills on April 01, 2012, 21:23:22

Title: caps is null in GL15
Post by: jbills on April 01, 2012, 21:23:22
I am new to lwjgl and Opengl, so please tell me if I am being stupid, but when I attempt to use glGenBuffer in GL15 I get a NullPointerException. When I look at it, the variable that is null is caps. Am I doing something wrong, or is this a bug?
Title: Re: caps is null in GL15
Post by: matheus23 on April 02, 2012, 09:15:57
try to check your OpenGL version, with
System.out.println(GL11.glGetString(GL_VERSION));
Just after creating your display.
If somthing less then 1.5 is print, your Drivers / Graphics Card does not support OpenGL Version 1.5.
Title: Re: caps is null in GL15
Post by: kappa on April 02, 2012, 09:38:05
Quote from: matheus23 on April 02, 2012, 09:15:57
try to check your OpenGL version, with
System.out.println(GL11.glGetString(GL_VERSION));
Just after creating your display.
If somthing less then 1.5 is print, your Drivers / Graphics Card does not support OpenGL Version 1.5.

Another way you can check if OpenGL 1.5 is supported is using the following

if(GLContext.getCapabilities().OpenGL15) {
   // OpenGL 1.5 supported
}
Title: Re: caps is null in GL15
Post by: jbills on April 02, 2012, 13:18:50
Quote from: kappa on April 02, 2012, 09:38:05
Quote from: matheus23 on April 02, 2012, 09:15:57
try to check your OpenGL version, with
System.out.println(GL11.glGetString(GL_VERSION));
Just after creating your display.
If somthing less then 1.5 is print, your Drivers / Graphics Card does not support OpenGL Version 1.5.

Another way you can check if OpenGL 1.5 is supported is using the following

if(GLContext.getCapabilities().OpenGL15) {
    // OpenGL 1.5 supported
}

I have tried that last version, but I think it is a problem with GLContext. I asked this question on stackexchange, and one of the answers was that GLContext was not thread safe as it claimed. The entire answer can be found here: http://stackoverflow.com/a/9970535/771790
Title: Re: caps is null in GL15
Post by: jbills on April 02, 2012, 14:22:16
Nevermind. I was being stupid. I was trying to run gl commands before creating a window. Sorry.