In order to try and learn how to use glDrawRangeElements() I am trying to just draw one simple quad using that method. If I use glBegin() and
glEnd() the program draws it no problem, but when I
do what you see here in the code, it draws nothing at
all. Interestingly, there are no errors at compile or run time either. Hopefully someone can straighten me out here.
Thanks
// "global" arrays
float[] vertexArray = {-2.0f, 0.0f, 0.0f,
2.0f, 0.0f, 0.0f,
2.0f, 4.0f, 0.0f,
-2.0f, 4.0f, 0.0f,};
float[] colorArray = {1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f};
int[] geomArray = {0, 1, 2, 3};
//======================================
public void init(GLDrawable drawable)
{
//...
// Enable needed vertex arrays
gl.glEnableClientState(GL.GL_COLOR_ARRAY);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
// Create the buffers
FloatBuffer vertexBuffer =
BufferUtils.newFloatBuffer(vertexArray.length);
FloatBuffer colorBuffer =
BufferUtils.newFloatBuffer(colorArray.length);
// Load the FloatBuffers used to draw the geometry
vertexBuffer.put(vertexArray);
colorBuffer.put(colorArray);
// Set up vertex array pointers
gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexBuffer);
gl.glColorPointer(3, GL.GL_FLOAT, 0, colorBuffer);
//...
//======================================
public void display(GLDrawable drawable)
{
//...
gl.glDrawRangeElements(GL.GL_QUADS,
0,
3,
4,
GL.GL_INT,
geomArray);
//...