View Full Version : Using the alpha channel in textures
10-12-2000, 02:02 AM
I am having difficulty getting the alpha channel to work in textures. I define the texture in the GL_RGBA format. The colors come out perfectly, except for the alpha (everything is opaque). Blending is enabled... I'm pretty lost here.
Thanks in advance!
10-12-2000, 02:10 AM
- Did you make sure you blended as GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPA ? I posted a demo of an RGBA textured cube on my site (home.conceptsfa.nl/~fredo , I hope it is up to date) although this is VB-programmed.
- Did you make sure the alpha -channel you loaded has value 0-255 in stead of 0-1?
- Lighting correct ? Normals correct ?
Otherwise post some code so I can see whats wrong
10-12-2000, 08:05 AM
Why should the alpha value be from 0-255 instead of 0 - 1? and since all my values are less than one, shouldn't I see some transparency anyway?
(I will post some code in a few minutes).
The range depends on what type of data you use. If you store alpha as integers, they should be in the range [0,255], where 255 is opaque. If you store alpha as floats, it should be in the range [0.0, 1.0], where 1.0 is opaque.
And as far as I understand, neither normals nor lightning should affect the way the alpha channel works.
Another problem with alpha channels is that you have to draw then in a specific order. You have to draw them from back to front, i.e. the triangles further away before the nearer triangles.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.