[osg-users] Adding an alpha channel to a texture?

Roger James roger at beardandsandals.co.uk
Tue Dec 4 16:35:39 PST 2007


Set the texture format to RGBA and when you bind a RGB image a default alpha
channel will be added.

 

  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Glenn
Waldron
Sent: 04 December 2007 20:21
To: OpenSceneGraph Users
Subject: [osg-users] Adding an alpha channel to a texture?

 

I want to set up a geometry such that when I apply a texture, it renders,
but when no texture is applied it is invisible. I created the geometry with
color (1,1,1,0) and I'm using the TexEnv::GL_REPLACE mode. This works
perfectly on 4-channel RGBA textures (because texture alpha replaces
fragment alpha), but on a 3-channel RGB texture the GL_REPLACE mode uses the
fragment's alpha color (which makes sense) and thus the geometry remains
invisible. 

Is there either a) an easy way to add an alpha channel to an existing
osg::Image, or b) a better way to solve this problem? (I know I can use node
masks etc., but I would prefer to do it simply by setting or removing the
texture attribute.) 

Thanks in advance! -gw

-- 
Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071205/82fe8834/attachment.htm 


More information about the osg-users mailing list