BlitzMax Hidden Buffer

BlitzMax Forums/BlitzMax Beginners Area/BlitzMax Hidden Buffer

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What I'm suggesting is that if you draw your foreground surface first with a custom blend mode, where the alpha channel doesn't affect what is being drawn but instead the alpha is actually draw TO the alpha of the backbuffer, then when you draw the background with another custom blend mode to multiply it by the backbuffer's alpha, it will only draw the pixels that were not occupied by the foreground, or only partially so. You should not need a third buffer at all. Look at the glBlendFunc() OpenGL call.

The difference between pixmaps and images is this: Pixmaps are handles by the CPU, Images are handled by the GPU (graphics processing unit). Pixmaps are slower because the GPU is usually much faster. Pixmaps are a custom Blitz-Max object to store image data, images (actually textures) are an OpenGL custom object for storing image data - handled by OpenGL via calls from BlitzMax. Images have to live in video ram (graphics memory) in order for OpenGL to be able to see it and do something with it. Pixmaps live in main system memory and in order to get them displayed by OpenGL they have to be transferred by the CPU from main memory, over the graphics bus, to the graphics card. DrawPixmap does that. So does the routine that creates or loads a new Image. Images are cached in graphics ram like data is cached in a CPU cache. It can only be modified directly by the GPU once it is there. It's fast but it can't easily be updated. You can make changes to pixmaps, draw to them and read from them, more easily than you can to an Image. To do it to an image you have to transfer it from graphics ram, over the bus, into main memory, then change it, then transfer it back again so that OpenGL can see it. This is changed somewhat in later versions of OpenGL.