Hello people!
I’m trying to make a system which draws a quad (summons an archer) at a certain location relative to the player.
I want it to be possible to summon a multitude of these.
My problem is that when I press the button to summon one of these, the previously summoned one disappears.
Pressing the button first adds 1 to ‘archernumber’, then sets the ‘ux’ (x position), uy and ‘uz’ to the players current position. Lastly it sets ‘summoned’ to TRUE.
Code section from the drawglscene which draws these polygons:
for (int archerdraw=0; archerdraw <= archernumber; archerdraw++) //draw archer
{
if (archer[archernumber].summoned && archernumber != 0)
{
glPushMatrix();
glTranslatef(archer[archernumber].ux,archer[archernumber].uy,archer[archernumber].uz);
glColor3f(1.0f,0.0f,0.0f);
glBegin(GL_QUADS);
// Front Face
glVertex3f(-0.25f, -0.25f, 0.25f); // Bottom Left Of The Texture and Quad
glVertex3f( 0.25f, -0.25f, 0.25f); // Bottom Right Of The Texture and Quad
glVertex3f( 0.25f, 0.25f, 0.25f); // Top Right Of The Texture and Quad
glVertex3f(-0.25f, 0.25f, 0.25f); // Top Left Of The Texture and Quad
glEnd();
glPopMatrix();
}
}
So what I need to know is why this code does not allow the existence of multiple quads, in other words why the previous quad disappears once I draw the next one.
Any help on how to fix this or what might be a better way of doing it is greatly appreciated.
On a side note: Can anyone tell me if there is something like glPushMatrix() that works on colours?
Many thanks in advance.