writing exture transparency

Blitz3D Forums/Blitz3D Programming/writing exture transparency

Shifty Geezer(Posted 2005) [#1]
I'm trying to create sprites out of 2D meshes. It works fine but I can't get any degree of transparency. I've been experimenting in just writing to a texture but I achieve absolutely nothing.

The basic idea is load a 2D, 2 triangle rectangle mesh.
Create a texture.
Use this code...
	buf= TextureBuffer(texture)
	LockBuffer buf
	For loop=0 To TextureWidth(texture)-1
		For loop1=0 To TextureHeight(texture)-1
			WritePixelFast(loop,loop1,$80ffffFF,buf); write back to the texture
		Next
	Next

	UnlockBuffer buf

and keep changing settings until I see something happening. I've gone through every combination of different write values, different textureflags, setting object alpha, but nothing allows me to vary the rectangle's transparency.

Ultimately I need per pixel masking, but that'll be easy (with ROss C's pointer) once i get any amount of texture alpha to work!!


Shifty Geezer(Posted 2005) [#2]
Solved ;)

Solution : When using CreateBuffer, add the Alpha flag at creation. Setting texture flags afterwards doesn't seem to work.