Question

I have a problem here with JOGL. I have a book here which explains OpenGL in C++ but my task is to do it in JOGL. I'm dealing with Vertex Buffer Objects now and the book tells me this:

glGenBuffers(1, &m_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);

What I've done in Java is this:

IntBuffer vertex_Buffer;
gl.glGenBuffers(1, vertex_Buffer);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vertex_Buffer);

The first line is what eclipse suggested but this doesn't fit to the parameters of glBindBuffer. Can somebody tell me what I have to do here?

Was it helpful?

Solution

glBindBuffer accepts only a single int as its second parameter as it only binds ONE buffer (while glGenBuffers can generate multiple buffers at once). Therefore, pass only one buffer like this:

gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vertex_Buffer[0]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top