BackBufferToTex() /Texture with alphavalues ?

BlitzMax Forums/MiniB3D Module/BackBufferToTex() /Texture with alphavalues ?

xMicky(Posted 2009) [#1]
Am I right in thinking, that through grabbing the backbuffer there is no way to write a Texture with alpha values <>255 ?

If so, are there any chances, that in a future version of miniB3D a command like "PixmapToTex()" or similar is added to write arbitrarily alpha values to a Texture ? In my opinion, this would be an important and useful feature for creating Textures on the fly during runtime.


xMicky(Posted 2009) [#2]
Sorry, well known effect: Minutes after posting a question you find the answer of your post by yourselve:

CreateTexture(width, height, 2)

allows taking a Texture with arbitrarily alpha values. My bad.


xMicky(Posted 2009) [#3]
So now the current state of my Knowledge is:

You can get a Texture with different alpha values by grabbing the background with BackBufferToTex(), if you created the Texture with flag =2. But where the background should has an alpha of 0, it has the backgrounds ClsColor and gives it to the Texture, so where the Texture should be transparent it has the backgrounds ClsColor instead.

So I my questions from post #1 live again:

Is there a way to get a Texture in parts transparent using BackBufferToTex() ?
If not - shall a future version of MiniB3 has a command to achieve this feature ?


ima747(Posted 2009) [#4]
BackBufferToTex() just grabs the back buffer, which doesn't have an alpha channel to my knowledge, clear color is clear color, not transparent, so there's no partial transparency, just masked or not masked. Perhaps CreateTexture(width, height, 4) will do what you want? 4 being the masked flag, rather than the alpha flag of 2.

I can't speak for the real devs, but I read in some post recently that the extended version will support drawing to textures in it's next major release, and I would imagine simon plans to add a similar ability some time in the future as official b3d supports a similar system. At the moment the best I've managed to hack together from snippets and help is to create a texture with alpha and fill it with a picture I've made by drawing various pictures together into one pixmap. Search the forums for DrawOnPixmap and you should find the samples I based mine off of. If you still have trouble I can try to dig up my code and post it for you but it's not pretty and fairly tweaked for my specific use.

Hopefully just using masking on the image you grab with backbuffertotex() is enough for you cuz digging into the alpha channel is a pain :0)