writing text into pixmap with openGL only

BlitzMax Forums/OpenGL Module/writing text into pixmap with openGL only

Bremer(Posted 2005) [#1]
Is it possible to write text into pixmaps using openGL commands only? So far anything I have read indicates that its only possible to write onto the screen buffer.

[edit] I am thinking that I might have to use bitmap font and write my own pixel pushing stuff.


ImaginaryHuman(Posted 2005) [#2]
The only way it would be possible would be to take text that has already been drawn to the OpenGL backbuffer and download it to a pixmap using something like GrabPixmap() or directly calling glReadPixels(). These however will use the CPU as the graphics-card hardware can only access and work with the textures that are stored in video ram. As soon as you try to bridge the gap from the video ram (inside openGL) and the main system memory (in the pixmap), you have to get the CPU involved to move stuff.

So no you can't directly use OpenGL to `render to a pixmap`. OpenGL is kind of a closed system. Video memory is also simlar to a CPU cache, whereby stuff has to be in the cache to work fast and if it's not there it has to be transferred from/to main memory with a slower operation.


Bremer(Posted 2005) [#3]
I figured as much, but wasn't sure. I will look into working with bitmap fonts then as I need a way to write text to pixmaps. Thanks for the info.


ImaginaryHuman(Posted 2005) [#4]
Could you make a window within a pixmap and draw to that window?


ozak(Posted 2006) [#5]
RenderTargets :)


Chris C(Posted 2006) [#6]
theres opengl pbuffers for that...


Dreamora(Posted 2006) [#7]
And how would all of that help him?
He wants it in pixmap which will be grab in any way.


Bremer(Posted 2006) [#8]
Its about nine months ago that I needed this. I have in the mean time made a bitmap font module that does what I need, but thanks for posting :)


Chris C(Posted 2006) [#9]
http://www.paulsprojects.net/opengl/rtotex/rtotex.html

you can quickly convert static memory to a static pixmap...