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];		
		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

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

what you need is something like

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
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