Milk
09-04-2006, 05:29 AM
Hi all,
What im attempting to do is place 10 strings stored in an array at different locations on the screen (same x and z coords but different y coords).
this is my code:
int y = 0.74;
for(int cardA = 0; cardA < 10; cardA++){
cardAttr cardAt = cardArray[cardA];
glPushMatrix();
glColor3f(0.68,0.68,0.68);
glRasterPos3f(0.11,y,0.11);
render_string(GLUT_BITMAP_TIMES_ROMAN_24, cardAt.cardName);
glPopMatrix();
y=y - 0.5;
}
What seems to be happening is all 10 strings are being placed in the same locatation so they are on top of one another. I believe that the location all 10 strings are is the final y value when the for loop has finished (so all the strings are in the position where the last string is meant to be).
Thanks for any help
What im attempting to do is place 10 strings stored in an array at different locations on the screen (same x and z coords but different y coords).
this is my code:
int y = 0.74;
for(int cardA = 0; cardA < 10; cardA++){
cardAttr cardAt = cardArray[cardA];
glPushMatrix();
glColor3f(0.68,0.68,0.68);
glRasterPos3f(0.11,y,0.11);
render_string(GLUT_BITMAP_TIMES_ROMAN_24, cardAt.cardName);
glPopMatrix();
y=y - 0.5;
}
What seems to be happening is all 10 strings are being placed in the same locatation so they are on top of one another. I believe that the location all 10 strings are is the final y value when the for loop has finished (so all the strings are in the position where the last string is meant to be).
Thanks for any help