BlitzMax Hidden Buffer

BlitzMax Forums/BlitzMax Beginners Area/BlitzMax Hidden Buffer

Tachyon(Posted 2005) [#1]
I'm sure this has been covered, but I can't find what I need so I thought I'd ask:

I need a 3rd buffer in BlitzMax (i.e. NOT the BackBuffer) to DrawImage to, after which I will draw this "3rd buffer" on to the backbuffer (with alpha transparency). Hopefully this makes sense to someone! Can anyone point me to a tutorial/sample to help me with this?

Thanks all!!


Red(Posted 2005) [#2]
Uses Pixmap

It's a kind of textureBuffer


Dreamora(Posted 2005) [#3]
There is no 3rd Buffer.

You would need something like a GeForce4 (real not MX) and the use of PBuffers for other "hardware buffers" in OpenGL


ImaginaryHuman(Posted 2005) [#4]
You could perhaps draw to the backbuffer, copy the backbuffer to the accumulation buffer, draw your second image to the backbuffer then multiple back the accumulation buffer content?

What are you trying to do exactly? Some kind of parallax?

I wonder if drawing to the backbuffer's alpha channel would help with filtering in/out the second graphic. You could draw the first image, then draw alpha images to the backbuffer's alpha channel to show how much of subsequent images you want to show, then set the rendering/blend mode of OpenGL so that it multiplies by the alpha value, then draw all the second layer of images in that mode so they only draw in the intensities of the alpha buffer.


Tachyon(Posted 2005) [#5]
AngelDaniel:

Yes, it's parallax trick that I've done before in Blitz3D so I know that it will work, but it will require me to draw to two seperate surfaces, then combine them onto the backbuffer. I'm counting on BlitzMax's alpha transparency feature to impove the look of the effect.

Basically I need to know if I can have another hidden surface, other than the Backbuffer, that I can DrawImage to.

Ed From Jupiter: can you point me to some good tutorials using Pixmaps? BlitzMax docs are terrible and I have no idea what the difference between a Pixmap and an Image is.


ImaginaryHuman(Posted 2005) [#6]
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.


AntonyWells(Posted 2005) [#7]
you can render to the back buffer, copy it to the texture(copies include processing, so you can still mask the copy), do the 2nd image, repeat above, do 3rd, repeat, then use a screen sized quad to blend them in either multi-pass or multi-textured.(Multi-pass will be more compatible, faster on most cards)


ImaginaryHuman(Posted 2005) [#8]
Grabbing the backbuffer into a texture is slow on a lot of cards, using the CPU. Even on my Geforce4MX it's slow.


AntonyWells(Posted 2005) [#9]
It's extremely fast on my ultra-budget g5-6000 card though, which can't cost more than a score these days considering it only cost 60 brand new.