Texture alpha not working right.

Started by JBR, January 11, 2020, 01:05:18

Previous topic - Next topic

JBR

Looked at the code for the radar (by Krischan a long time ago!)

It is working perfectly with minib3d but I cannot get rid of the solid rectangle in openb3d.

Does openb3d have alpha issues?

Thanks, Jim.

angros47

Which format have you used for the radar picture?

JBR

CreatePixmap( texture_size%,  texture_size%, PF_RGBA8888)

and later I use pixmaptotexture. (Which forces the image to above setting)

Jim.

angros47

Have you specified, in CreateTexture, to use alpha mask? (flag 4)

JBR

Hi, flag 4 is 'Masked'.

Tried it and it works. Not alpha though, so the edges are a bit 'sharper' than they should be.

Thanks for the help. Jim.

Kippykip

I used some funny workarounds, I have this in a DEFS.bmx to make things easier:

Const TextureFlags_Color:Int = 1 '1:Color (Default)
Const TextureFlags_Alpha:Int = 2 '2:Alpha
Const TextureFlags_Masked:Int = 4 '4: Masked
Const TextureFlags_Mipmapped:Int = 8 '8: Mipmapped
Const TextureFlags_ClampU:Int = 16 '16: Clamp U
Const TextureFlags_ClampV:Int = 32 '32: Clamp V
Const TextureFlags_Sphere:Int = 64 '64: Spherical environment map
Const TextureFlags_Cubic:Int = 128 '128: Cubic environment map
Const TextureFlags_VRam:Int = 256 '256: Store texture in vram
Const TextureFlags_HighColor:Int = 512 '512: Force the use of high color textures


Then load texture like so here:
https://kippykip.com/b3ddocs/commands/3d_commands/LoadTexture.htm

I find if you use alpha textures and don't specify any flags, there's a chance it'll use whatever texture filter the last thing drawn to the screen was before.
For actual meshed with predefined textures, my workaround was to add this to the top of my project:
TextureFilter("M#", 1 + 4)
TextureFilter("m#", 1 + 4)
TextureFilter("A#", 1 + 2)
TextureFilter("a#", 1 + 2)

Then when I load meshes and it loads a texture from the model, if the beginning of the filename has "m#" it'll be masked, otherwise if it begins with "a#" it uses alpha.

Hopefully these tips don't require a huge rewrite ;)

JBR

Thanks Kippykip,

I'm not actually loading in textures, just creating them.

Might use your online documents. :-)

Thanks, Jim.

JBR

Kippykip, your online manual is much better than the one built into B3D. I thank you for it!

Fixed the alpha not working, you have to do EntityFX <entity>, 32. This FORCES alpha.

Having fun, Jim.

Kippykip

Quote from: JBR on January 16, 2020, 02:04:09
Kippykip, your online manual is much better than the one built into B3D. I thank you for it!
I'm late to respond but yeah back when Blitz3D was still up for download, there was an updated helpdocs .exe.
This is just a mirror of the updated b3ddocs help html pages but 95% also applies to OpenB3D :)