CreateTexture( , , 4 )

Blitz3D Forums/Blitz3D Beginners Area/CreateTexture( , , 4 )

Raul(Posted 2005) [#1]
Hi,

I can't put graphics to a "masked" texture.

example:
------------

tex = CreateTexture( 256,256,4 )
SetBuffer TextureBuffer( tex )
DrawImage image,0,0
...

With a "non-masked" texture, it works.


Thanks for help.


Stevie G(Posted 2005) [#2]
Using DrawImage will overwrite the alpha channel, making it 0, so the image will not be seen. To use the masked function correctly in code you need to specifically set the alpha of the coloured pixels to $FF so that they are visible.

There is a function in the code archives which will help you here.


http://www.blitzbasic.com/codearcs/codearcs.php?code=1013


Raul(Posted 2005) [#3]
...sorry, I have slow web connection and I can't stay many times to find the right topic in archives :(

(...)

I have tested the function and now, I understand that we can only draw into masked texture with WRITEPIXEL / WRITEPIXELFAST.
Also using LockBuffer.

Many thanks for attention !


Graythe(Posted 2005) [#4]
I think this is what you need. As Stevie G says, This function (code ripped from BR archives) returns RGB+Alpha.

Function GL_GetRGB%(Red%,Green%,Blue%)
Return 255 Shl 24 + Red Shl 16 + Green Shl 8 + Blue
End Function


TomToad(Posted 2005) [#5]
The only way to make people appreciate things is to periodically take them away.

So how will taking all the people away make them appreciate things?


Graythe(Posted 2005) [#6]
TomToad - :D


Sir Gak(Posted 2005) [#7]
There's a song called "Big Yellow Taxi", in which the chorus goes: "Don't it always seem to go, that you don't know what you've got 'til it's gone."

The song speaks truth. Sometimes we don't know/appreciate what we have until we lose it.