glDrawArrays() not working on Mac OS X
I am practicing the usage of VBOs in OpenGL with Java and LWJGL (using
this tutorial, and basically copying it's code:
http://www.arcsynthesis.org/gltut/index.html) and right now something
really weird is happening.
I have a window set up and this is my render() function, called inside the
main loop:
public void render() {
FloatBuffer buffer = BufferUtils.createFloatBuffer(3 * 3);
buffer.put(-1);
buffer.put(-1);
buffer.put(0);
buffer.put(0);
buffer.put(1);
buffer.put(0);
buffer.put(1);
buffer.put(-1);
buffer.put(0);
buffer.flip();
int vbo = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE * 4, 0);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(0);
}
As you can see, it's very simple code which should draw a triangle. But
what I get on a Mac OS X Mountain Lion laptop, running Intel HD 4000
graphics is this:
And what I get on Windows 7, running AMD HD 6850 graphics is this:
Why is that? I really see no reason for this to happen, both of the video
cards support OpenGL 2.0, which is what I'm using, right?
No comments:
Post a Comment