How the data type of OpenGL is handled in LWJGL?
like, in the following C++ code
glVertexPointer(3, GL_FLOAT, 0, vertices);
what should be written, instead GL_FLOAT while using LWJGL?
If you're using a FloatBuffer, you don't need to specify type at all, as it is implicit from the buffer:
glVertexPointer(size, stride, floatBuffer);
Cas :)
according to documentations
glVertexPointer(3, GL_FLOAT, 0, vertices);
here, GL_FLOAT is the data type, which is similar to C / C++ 's float data type.
isn't the final argument should be the array of vertex data, in glVertexPointer?
Sorry, I dont understand what you mean by float buffer.
I am following a tutorial from here,
http://www.songho.ca/opengl/gl_vertexarray.html
what is stride?
That's the C API documentation. The Java APIs are slightly different to account for the fact that Java does not have pointers.
In C you'd pass in a pointer to a float "array" and tell OpenGL you're using floats by passing GL_FLOAT in.
In Java, you'd use a FloatBuffer, the data type of which is explicitly GL_FLOAT. So in LWJGL, we don't ask you for the type parameter as it is already implied by the type of the buffer you pass in.
Stride is either zero (tightly packed vertex data), or the number of bytes between each vertex if they are not tightly packed and need some padding. The value is the total distance between the start of one vertex and the next, not the size of the required padding.
Cas :)
thanks.
So, usually what i should do when it comes to GLuint, GLfloat type data?(when converting C / C++ code to Java)