glVertexAttribPointer offset problem

Started by DuffCola, March 15, 2015, 09:45:45

Previous topic - Next topic

DuffCola

Hello,
I am coming from C++ and moved now to Java and LWJGL to program a small OpenGL application.
Currently I have the problem, that the "GL20.glVertexAttribPointer" function takes a XBuffer(FloatBuffer, IntBuffer...) as last offset argument.
I am now a little bit confused because I am used to (from C++) simply pass the offset as a simple number of bytes because I use VBO's and VAO's.
But with this XBuffer objects I have no idea how to represent only a specefied offset.
I hope someone can it explain to me. :)

Kai

Have a look at the overload list of GL20.glVertexAttribPointer again. There is a method with signature:
public static void glVertexAttribPointer(int index, int size, int type, boolean normalized, int stride, long buffer_buffer_offset)

This is your friend. :)

DuffCola

Yes, but there is no overload for long.
Only for FloatBuffer, DoubleBuffer and IntBuffer.
I have the newest stable lwjgl 3 version.
But "GL30.glVertexAttribIPointer(index, size, type, stride, pointerOffset);" has the long overload.
Thanks.

Kai


DuffCola

.. I dont know why, but suddenly eclipse displayed the right overload... crazy
Thanks  :)