PDA

View Full Version : Converting between raster and model translate coordinates



Caspa
08-28-2005, 07:56 PM
Hi all,

Very new to this so forgive me if you can't quite understand what I am writing. I have a screen where I am drawing a number of squares and need to attach to each of them some text. The screen uses the following:
glviewport(0, 0, self.width, self.height)
gluPerspective(45.0, self.width/self.height, 0.1, 1000)
I am using glutBitmapCharacter() to draw the text which requires raster positioning, but the squares are positioned using glTranslatef(). Is there any easy way to convert between these two representations so that I can draw the text onto these squares (the number and position of these squares varies at run-time so it can't be hard coded).

Thanks!

memfr0b
08-28-2005, 11:19 PM
Use glRasterPos to position your text. It applies the same transformations as glVertex to calculate the screen position.

Caspa
08-29-2005, 12:00 AM
Thanks, i think I must have got myself a bit confused (hence the stupid question) - it was a problem with my code, but all sorted now

Cheers :)