Hi, I'm having some trouble getting GL_POINTS to show up. I thought I was setting everything up correctly, but nothing seems to happen.
I've created a series of buffers with:
vertexBuffer = ByteBuffer.allocateDirect( BYTES_PER_COORDINATE * COORDINATES_PER_VERTEX * VERTICES_PER_RENDER * (_bufferCapacity + BUFFER_CAPACITY_STEP) ).order(ByteOrder.nativeOrder()).asFloatBuffer();
colourBuffer = ByteBuffer.allocateDirect( BYTES_PER_COLOUR * COLOURS_PER_VERTEX * VERTICES_PER_RENDER * (_bufferCapacity + BUFFER_CAPACITY_STEP) ).order(ByteOrder.nativeOrder()).asFloatBuffer();
indexBuffer = ByteBuffer.allocateDirect( BYTES_PER_INDEX * INDICES_PER_VERTEX * VERTICES_PER_RENDER * (_bufferCapacity + BUFFER_CAPACITY_STEP) ).order(ByteOrder.nativeOrder()).asIntBuffer();
Everytime I want to add a point, I use:
_indexBuffer.put( _renderCount - 1 );
_vertexBuffer.put( x );
_vertexBuffer.put( y );
_colourBuffer.put(colour.r);
_colourBuffer.put(colour.g);
_colourBuffer.put(colour.b);
_colourBuffer.put(colour.a);
For reference, the vertex and colour array states are always enabled, and some of my other code expects the texture coordinate array to be enabled, that's why I flip it here:
public void render( float left, float top ) {
GL11.glVertexPointer(COORDINATES_PER_VERTEX, 0, _vertexBuffer);
GL11.glColorPointer(COLOURS_PER_VERTEX, 0, _colourBuffer );
GL11.glDisableClientState( GL11.GL_TEXTURE_COORD_ARRAY );
if ((left != 0.0f) || (top != 0.0f)) {
GL11.glTranslatef(left, top, 0.0f);
GL11.glDrawElements( GL11.GL_POINTS, _indexBuffer );
GL11.glTranslatef(-left, -top, 0.0f);
} else {
GL11.glDrawElements( GL11.GL_POINTS, _indexBuffer );
}
GL11.glEnableClientState( GL11.GL_TEXTURE_COORD_ARRAY );
}
But nothing ever shows up on the display. Now, I tried playing with the index value I was putting in _indexBuffer, and giving it bogus values did crash the app, so it does appear to be processing the data, I just never see anything on the display.
Is there anything obvious I'm doing wrong? I'm using a very similar system to draw some textured triangles and that works just fine and this is based off of that code.