Results 1 to 5 of 5

Thread: gluUnProject help!!!

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2002
    Posts
    2

    gluUnProject help!!!

    I have a function DrawText(text, x, y)
    I need to enter the Window coords and not the ogl coords to position the text. I use gluUnProject for this, but the x,y is way out of the correct coordinates. 0,0 is the center, (it has to be top left), and the results are too big. to move the text, i need to change the x or y by a large number, eg 500 or 1000 for an 640x480 reolution. thats why I think it is not correct. Can someone help me?

  2. #2
    Guest

    Re: gluUnProject help!!!

    Why not just change the project matrix to
    an Orthogonal matrix, then you can use
    the window cords to position your text...

    or does your text NEED to be in the 3d world??

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: gluUnProject help!!!

    There's a recent post on gluUnproject about 10 - 15 threads below yours. http://www.opengl.org/discussion_boa...ML/007109.html

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2002
    Posts
    2

    Re: gluUnProject help!!!

    I see it, but I just get the wrong results. the x and y I have to enter are too big.
    This has nothing to do with the above, but do you know how to do this:
    Make a function for accepting 4 color values, like ColorRGBA(r,g,b,a) and use it in another function like this:
    DrawCircle(x,y,color)
    where I can use then: DrawCircle(100, 100, ColorRGBA(1.0, 0.0, 0.0, 1.0))
    for example? pretty hard to explain. so if I have a box, I wont give 4 different r,g,b,a in a function, since it will make it verryy large.

    [This message has been edited by Neo3D3D (edited 02-06-2002).]

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: gluUnProject help!!!

    Are you using gluUnproject after you've done all your transformations. Otherwise the results will be off.

    glMatrixMode(GL_PROJECTION)
    gluPerspective(...)
    ...

    Then
    glMatrixMode(GL_MODELVIEW)
    glRotate(...)
    glTranslate(...)
    ...

    gluUnProject(...)

Similar Threads

  1. gluUnProject
    By Raiden in forum OpenGL: Linux
    Replies: 1
    Last Post: 04-11-2005, 09:33 AM
  2. gluUnProject
    By Amir in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-10-2004, 01:53 PM
  3. Example of gluUnProject
    By jirkamelich in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-11-2002, 08:53 AM
  4. gluUnProject
    By mphanke in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-24-2002, 08:28 AM
  5. Once again, gluUnProject...
    By Tanus in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-08-2001, 05:35 PM

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