View Full Version : gluUnProject help!!!

02-06-2002, 04:29 AM
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?

02-06-2002, 04:58 AM
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??

02-06-2002, 05:31 AM
There's a recent post on gluUnproject about 10 - 15 threads below yours. http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/007109.html

02-06-2002, 07:13 AM
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:
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).]

02-06-2002, 07:37 AM
Are you using gluUnproject after you've done all your transformations. Otherwise the results will be off.