LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: julien.1486 on February 28, 2009, 15:27:46

Title: [Solved] NullPointerException in ARBBufferObject.glGenBuffersARB()
Post by: julien.1486 on February 28, 2009, 15:27:46
Hi !

I'm writing a piece of code in order to render my model using VBOs and this :

vbos = BufferUtils.createIntBuffer(mats.size()*2);            //mats.size() = 2         
ARBVertexBufferObject.glGenBuffersARB(vbos);


throws a NullPointerException at org.lwjgl.opengl.ARBBufferObject.glGenBuffersARB(ARBBufferObject.java:59);
This line is :
long function_pointer = caps.ARB_buffer_object_glGenBuffersARB_pointer;

Is it something strange with GLContext.getCapabilities() ? Because this line throw a NullPointerException too :
if(GLContext.getCapabilities().GL_ARB_vertex_buffer_object){
// ...
}


I don't know what to do  :-\

Thanks a lot for your help !
Title: Re: NullPointerException in ARBBufferObject.glGenBuffersARB()
Post by: Matzon on March 01, 2009, 09:08:30
have you created the display or pbuffer first?
Title: Re: NullPointerException in ARBBufferObject.glGenBuffersARB()
Post by: julien.1486 on March 01, 2009, 12:51:09
Yes, I guess...

I have a createWindow() function :
private void createWindow() throws Exception {
        Display.setFullscreen(fullscreen);
        DisplayMode d[] = Display.getAvailableDisplayModes();
        for (int i = 0; i < d.length; i++) {
            if (d[i].getWidth() == 640
                && d[i].getHeight() == 480
                && d[i].getBitsPerPixel() == 32) {
                displayMode = d[i];
                break;
            }
        }
        Display.setDisplayMode(displayMode);
        Display.setTitle(windowTitle);
        Display.create();
    }
Title: Re: NullPointerException in ARBBufferObject.glGenBuffersARB()
Post by: Matzon on March 01, 2009, 13:42:40
yes, but are you sure that the method has been called first?
Title: Re: NullPointerException in ARBBufferObject.glGenBuffersARB()
Post by: julien.1486 on March 01, 2009, 13:55:58
Oh, no  :-[

You're right ! I called my function first in order to do some tests...

Thank you for the solution, Matzon  ;)