WritePixelFast to a texture

Blitz3D Forums/Blitz3D Programming/WritePixelFast to a texture

big10p(Posted 2007) [#1]
I know drawing directly to a texture doesn't work on some cards - is the same true with using WritePixelFast to a texture?

I can't draw to an image and then use CopyRect as I want to preserve the alpha channel.


Stevie G(Posted 2007) [#2]
Not much help but I've never had a problem myself. It may just be writing text to a texture which doesn't work on some cards. Writing Text to a texture works on my lowly Gfx440mx.

Stevie


big10p(Posted 2007) [#3]
Oh, is it just writing text to a texture that doesn't work on some cards? So, using Oval, Line etc. is ok?


Dreamora(Posted 2007) [#4]
text write is no problem as well. Just make sure you disable the image filtering before doing so, as this is the reason it goes bogus.


big10p(Posted 2007) [#5]
Image filtering?


jfk EO-11110(Posted 2007) [#6]
Oval doesn't work. I think it's all dx 2d commands. Writepixel and Writepixelfast should however work everywhere.

You may also draw to the backbuffer and then copyrect to the texturebuffer, I guess that's faster than images.

You may also copyrect from one texturebuffer to an other. Surprisingly you can copy the alpha channel this way, (at least as far as I remember)

Sometimes it's better to use the add-blendmode instead of alpha, example given: for onscreen text. You don't need to do slow alpha poking in this blendmode, but the brightness will set it's transparency automaticly (black = transparent).


big10p(Posted 2007) [#7]
Thanks for the info.

Unfortunately, I can't use CopyRect as I wan't to preserve alpha, and I can't use add blend because I wan't parts of the sprite to be solid colour. I did try add blend but it didn't look too good.


Dreamora(Posted 2007) [#8]
Image filtering = TFORMFILTER command
it will interpolate your images when drawing (reason rotating image costs that much performance)

And what do you mean by "preserve alpha".
Images don't have an alpha channel nor do they draw one.
What you get at best is Masking.


big10p(Posted 2007) [#9]
Images don't have alpha channel, but textures do, which is what I'm using. ;)


_33(Posted 2007) [#10]
In the same sort of topic, which one is faster:
- WritePixelFast in a TextureBuffer
- WritePixelFast in an ImageBuffer

??? I found that WritePixelFast is rather slow in a TextureBuffer with the 256 flag.