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?

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??

There’s a recent post on gluUnproject about 10 - 15 threads below yours. http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/007109.html

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).]

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(…)