CopyRect into an alpha map?

Blitz3D Forums/Blitz3D Programming/CopyRect into an alpha map?

John Pickford(Posted 2003) [#1]
I want to copyrect a chunk of screen into to the alpha part of a texture?

Can I do this?


jfk EO-11110(Posted 2003) [#2]
If you want to copy only the Aphabytes then I am afraid it will not work with copyrect.

But you could use writepixelfast. Then you could choose R,G or B to use them as Alpha, or, a bit slower, calculate the average Brightness ((r+g+b)/3) and use this for the alphabyte.


John Pickford(Posted 2003) [#3]
Ahhh. I though the alphamap was a seperate texture.

Back to the drawing board then...


CyBeRGoth(Posted 2003) [#4]
Have a look here
http://www.blitzbasic.com/Community/posts.php?topic=26659

The function 0DFEx came up with might work for you, or atleast be something to start from.


fredborg(Posted 2003) [#5]
You could have an alpha map in texture layer 0, and another texture on which you use copyrect in texture layer 1. I'm not sure if all graphics cards support this, but it works on my machine.


John Pickford(Posted 2003) [#6]
Ultimately what I want to achieve is a texture map which dictates a blend between two other maps.

A value of 0 should show the pixel from texture A a value of 255 would show the pixel from texture B and anywhere in between would be a blend of the two pixels\texels.

I have Texture A, Texture B and the the grayscale blend texture - I'm just trying to figure out how to get the blend working.


Rob(Posted 2003) [#7]
I want copyrect with alpha channel support either using black or alpha pixels... I see no reason why it shouldn't work when copying from one texture to another as the alpha information is present (not when you render to a scene however but here black could be used).

Another thing I would like is being able to write to an exclusive alpha channel without writepixel commands. For example lockbuffer alphabuffer(texture).... then blit as usual using drawimage. Yes, drawimage or any other drawing commands, but remember it would be blitted as a factor between 0..255.

Bit custom and time consuming for mark to add, but a lot of power for us.