Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: glRasterPos3f not accpeting a variable for y value

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2006
    Posts
    22

    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:

    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    658

    Re: glRasterPos3f not accpeting a variable for y value

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2006
    Posts
    22

    Re: glRasterPos3f not accpeting a variable for y value

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

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •