Skip to main content
gamedev.net
🔒 Locked

Vertex Array

Started by anakin_skywalker May 24, 2003 at 11:52 AM 5 replies 600+ views
Original Post
anakin_skywalker
anakin_skywalker
Hi everyone. I am trying to create a Polygon from a vertex array. This is my code,,,,but seems that it doesn''t work. //This is my Ortho2D //Crete Coordinate system gluOrtho2D((GLdouble)-10,(GLdouble)10,(GLdouble)-10, (GLdouble)10); //This is my vertice Array. GLint vertices[] = {-5,0,0,5,5,5}; //First Clear Back glClear(GL_COLOR_BUFFER_BIT); //Enable Client State glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2,GL_INT,0,vertices); //Draw glBegin(GL_POLYGON); //Set Yellow Color glColor3f(1.0, 1.0, 0.0); glEnd(); //Flush it glFlush(); //Swap buffer; SwapBuffers(globalDC); Thanks for your help..
Hippokrates
Hippokrates
You still have to call glDrawElements AFAIK.
Im Anfang war die Tat...Faust
anakin_skywalker
anakin_skywalker
Do I have to call it between the glBegin() and glEnd() or after a declared my glVertexPointe()?

Thanks for your help Hippokrates!!
Hippokrates
Hippokrates
AFAIK (and I do not know that much) you kan skip glBegin and glEnd and use just glDrawElements.
This is because by using glBegin/glEnd you specify what kind of primitive you want to render. But you must tell it glDrawElements anyway.
If you want to know what parameters it takes just go to google and type ''glDrawElements''.
Im Anfang war die Tat...Faust
Hairybudda
Hairybudda
Ummm, dont quote me on this, but calling a vertex buffer in immediate mode (in between glBegin and glEnd) is illegal and will result in nothing?
st0ned
Brother Bob
Brother Bob
quote:
Original post by Hairybudda
Ummm, dont quote me on this, but calling a vertex buffer in immediate mode (in between glBegin and glEnd) is illegal and will result in nothing?

It will result in an error, but nothing on the screen at least

Seriously, it is indeed illegal to draw vertex arrays between a begin/end pair, unless you use glArrayElement to draw the arrays, then you have to use them between begin/end pair. glArrayElement is a mix between vertex array and immediate mode; you use vertex arrays, but call each vertex, one by one, manually.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.