I have created an object using a vertex array as follows.
void draw_pot(void){
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();
}
I then call the function.
void DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(0.5,1,1);
glPushMatrix();
draw_pot();-function called.
glrotatef(90,1,0,0);
glPopMatrix;
glColor3f(0,1,0);
draw_stem();
//drawCircle();
draw_petal();
glFlush();
As you can see i have tried to draw the pot and then create another instance of the pot in a different place but have been unsuccessful.
Any ideas?
gmeed
2
In the code in your post, you only draw it once. Did you mean to call draw_pot again between the rotate and popmatrix calls?
p.s. careful with the terminology - you’re storing vertices in an array, but you aren’t using it as a vertex array, as in glDrawArrays.
I did mean to call it again. How do i store it in a vertex array instead of an array?
How do i use glDrawArrays?
oh c’mon…
there’s documentation all over the place…
google ‘glDrawArrays’, you’ll get mucho hits.
opcode
6
Do yourself a favor and buy the red book.
http://www.amazon.com/exec/obidos/tg/det…=glance&s=books
Then, do us all a favor and buy the blue book.
http://www.amazon.com/exec/obidos/tg/det…=glance&s=books
You’ll be rockin’ with vertex arrays in no time, you may even use display lists too.