PDA

View Full Version : oglft fails to render properly with glDrawPixels



rakeshthp
11-21-2013, 07:54 AM
Hello,

I am working on a scientific visualization application using opengl. I also use additional library called Global Mapper. Now Global Mapper doesn't have rendering interface with OpenGL directly. So the indirect way to get Global mapper's output to my opengl based application is to render Global Mapper's output into memory, read it in OpenGL using read pixels and render again using glDrawPixels().


It works fine with other entities which are being rendered in opengl. I face issues only when a OGLFT based text is inserted and rendered. Once the text is used, I can see there is a shift in the position of objects rendered with Global Mapper. At a times, I can also see there forms a transparent margin, beyond which the Global Mapper's output is not rendered (as if the viewport is restricted).


No doubt OGLFT is wonderful text rendering library and I don't want to ignore it. I just digged into the code, and I saw that OGLFT library uses glRasterPos2i during rendering. And probably this might be causing the shift to occur. If I don't use texts, then I don't see this offset. How can I reset the raster position for glDrawPixels() so that I do not the any shift at the left hand side? Would rendering pixels to textures help?


Thanks


Regards

mhagain
11-21-2013, 09:39 AM
The default raster position is at 0, 0 so calling glRasterPos2i (0, 0) should be sufficient to reset it so that it gives you the expected results with glDrawPixels.

In general, yes, this is all deprecated functionality that may or may not be hardware accelerated, and if so, may or may not be accelerated well, on some platforms. If it works well enough for what you're doing there's no real reason to change from it, but be aware that it's not great as a general-purpose solution.

rakeshthp
11-21-2013, 05:57 PM
The default raster position is at 0, 0 so calling glRasterPos2i (0, 0) should be sufficient to reset it so that it gives you the expected results with glDrawPixels.

In general, yes, this is all deprecated functionality that may or may not be hardware accelerated, and if so, may or may not be accelerated well, on some platforms. If it works well enough for what you're doing there's no real reason to change from it, but be aware that it's not great as a general-purpose solution.

I tried doing that. With this change, if part of the object rendered using glDrawPixels() moves out of the viewport or window screen, entire object becomes invisible. How do I overcome this?

Thanks