Given the following OpenGL call stack.
According to my knowlegde, the calls to glDrawElements/Arrays are ok.(?)
But, they do not draw anything. (There is no triangle)
The calls to glBegin() and glVertex() works fine.
Full source: here
Given the following OpenGL call stack.
According to my knowlegde, the calls to glDrawElements/Arrays are ok.(?)
But, they do not draw anything. (There is no triangle)
The calls to glBegin() and glVertex() works fine.
Full source: here
Turns out LWJGL does not allow the use of .wrap() to create a FloatBuffer?
Use BufferUtils.createFloatBuffer(), then put() and flip().
Ive created an issue on their github to see the answer
glBufferData(type, data, draw);
And likewise at your other glBufferData call.
These are not legal glBufferData calls; please see https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBufferData.xhtml
void glBufferData( GLenum target,
GLsizeiptr size,
const GLvoid * data,
GLenum usage);
As you'll see, glBufferData actually has 4 parameters, with the second one - GLsizeiptr size
- being the one that is missing from your calls. It's also important that this is the size of the data
parameter in bytes, and not the number of items in an array.
You should bind the element array before you draw something with it. It's not a problem now, because you only have a single element buffer, but if you want to draw multiple meshes, it's necessary.
You don't actually need to disable anything, it only introduces unnecessary function calls.
gDraw*
versions. \$\endgroup\$