Invalid Value with glBufferSubData

Started by nickbrickmaster, November 02, 2013, 19:36:03

Previous topic - Next topic

nickbrickmaster

FloatBuffer verticesBuffer =
	BufferUtils.createFloatBuffer(vertices.length *
		TexturedVertex.elementCount); 
for (int o = 0; o < vertices.length; o++) { 
	verticesBuffer.put(vertices[o].getElements()); 
}
verticesBuffer.flip();
				 
catchError("update1");
GL15.glBufferSubData(GL15.GL_ARRAY_BUFFER, i * TexturedVertex.stride,
	verticesBuffer); 
catchError("update2");


Whenever this code is run, it generates an Invalid Value opengl error. Also, if
GL20.glEnableVertexAttribArray(3);
is run before the render cycle, (it holds normals, but nothing in the shader is bound to it) than it does not render either. To be clear update2 is the one that sees the exception.

quew8

That error is thrown if:
Quote
offset or size is negative, or if together they define a region of memory that extends beyond the buffer object's allocated data store.

and size for the purposes of LWJGL is the difference between the buffer's position and limit. So just check that the buffer (OpenGL buffer) you created is large enough and the TexturedVertex.stride is also correct. I'm afraid I can't be of any more help without seeing more code. Like the OpenGL buffer creation, getElements() of TexturedVertex and the constants in TexturedVertex.