PDA

View Full Version : glRasterPos2d(), rounding errors when zooming?



timzzzz
10-25-2009, 01:54 PM
Hello everybody,

I'm beginning learning OpenGL programming and have a problem with placing a bitmap text in the upper left corner of the screen.

For the placement of the text I use the glRasterPos2d() function to convert screen coordinates (pixels) into object coordinates. The pixel coordinates are always the same, because the text should appear at the same position all the time. The text is displayed via the glutBitmapCharacter() function. This works fine, also when I zoom into the model via a scaling of the model via glScaled(). But when I zoom a couple of times it happens that the text begins to hop to another pixel position on the screen. Is this a problem due to the conversion from object coordinates which are given to glRasterPos2d() back to screen coordinates? I use double precision values for all variables.

I also tried glWindowPos2dARB() which I found to be useful in this context in some of the postings in this forums. But I have the problem that I get linker errors after compilation. I included glext.h and also defined GL_GLEXT_PROTOTYPES 1 before including glext.h.

I use OpenGL together with wxWidgets on Windows XP on a Laptop from 2004 with an ATI MOBILITY RADEON 9700 graphics card.

Thank you very much for your help.

Cheers, Tim

Pierre Boudier
11-20-2009, 08:28 AM
hi,

what is your link error ?

the function "glWindowPos2dARB" is an extension, so you need to query it at runtime, and you can't statically link against it on windows.

regards,

Pierre B.
AMD Fellow