Results 1 to 3 of 3

Thread: Converting between raster and model translate coordinates

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2005
    Posts
    6

    Converting between raster and model translate coordinates

    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!

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: Converting between raster and model translate coordinates

    Use glRasterPos to position your text. It applies the same transformations as glVertex to calculate the screen position.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2005
    Posts
    6

    Re: Converting between raster and model translate coordinates

    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

Similar Threads

  1. Replies: 1
    Last Post: 02-20-2014, 08:35 PM
  2. problem converting from win coordinates to object coordinates
    By openujs in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-07-2006, 01:27 PM
  3. converting window coordinates to world coordinates
    By pwonder in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 09-26-2004, 12:51 PM
  4. 3D coordinates from 2D raster position
    By HarryB in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-30-2003, 06:12 AM
  5. Converting LOCAL coordinates to WORLD coordinates - How do I do it?
    By VuurSnikkel in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-23-2002, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean