Pixmaps

BlitzMax Forums/BlitzMax Beginners Area/Pixmaps

RetroRusty(Posted 2005) [#1]
Can someone please explain to me in detail exactly what pixmaps are and how to use them?

Thanks


teamonkey(Posted 2005) [#2]
A TPixmap is an image stored is system memory. This is opposed to a TImage, which is an image stored in video card memory.

Drawing to the screen with a TImage is much, much faster than TPixmap. The only advantage that TPixmap has is that it is easier to modify individual pixels on a TPixmap. If you don't need to use a pixmap you should use a TImage instead.

http://blitzwiki.org/index.php/Category:Pixmap


ImaginaryHuman(Posted 2005) [#3]
Currently the main purpose of a Pixmap is because pixmaps are implied as being needed as part of the OpenGL specification. Since OpenGL works with Images that are in video ram, which are considered `inside` the OpenGL state machine, it can't work on images outside of the video ram. So to interface with Images outside, ie in main memory, you have to use Pixmaps.

So as teamonkey said, a pixmap is just an image in main memory as opposed to in video ram. Video ram is like a CPU cache - you can put stuff in there but you can't easily edit it when it's in there. Images are more or less fixed as they are. But pixmaps you can still have the flexibility of editing them. Then to get the pixmap into a state where OpenGL can display it, you have to turn the pixmap into an Image (ie put it in video ram) or transfer it to the backbuffer. You can do a few things like drawpixmap which handles this.