glRasterPos3f not accpeting a variable for y value

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];		
			render_string(GLUT_BITMAP_TIMES_ROMAN_24, cardAt.cardName);
		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

maybe you have set up your modelview matrix in a way that you’re looking into y-direction?

what you need is something like

gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

to look upon the x-y-plane.

Hi thanks for the reply. I tried it, thats definately not the case. Im definately looking through the z axis. Thanks :slight_smile:

Edit: Nevermind ive got it, im stupidly using an int not a float shoots himself