Skip to main content
gamedev.net
🔒 Locked

Vertex Array transformations.

Started by legendkiller 0 replies 300+ views
Original Post
legendkiller
legendkiller
I have declared the object as follows. void draw_pot(void){ for (int i=0;i<3;i++){ GLdouble ShapeVertexArray[30] ={95,80,80,130,140,130,125,80}; glBegin(GL_POLYGON); for (int i=0;i<4;i++) glVertex2d(ShapeVertexArray[2*i],ShapeVertexArray[2*i+1]); glEnd(); } } How would i go about using glDrawArray to create the shape and in turn perform transformations on the shape.
reiko
reiko
Your code seems a bit strange... what is the outer for(i) loop doing? Anyway, assuming that part is unintentional, it should be easy enough to convert the glBegin/glEnd block to use a vertex array.

You'll need to glEnableClientState(GL_VERTEX_ARRAY); and set glVertexPointer(2, GL_DOUBLE, 0, ShapeVertexArray);

Then you can call glDrawArrays(GL_POLYGON, 0, 8); to draw the polygon. Don't forget to DisableClientState at the end.

Topic Locked

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

Sign in to reply to this topic.