If you need to reformat an image (say, change RGB to RGBA), I'd allocate a
new Image and copy it pixel by pixel. However, you might just be able to
change the format of the existing image and osg::Image will do the right
thing. Not sure, check the source.
Image has the following method for setting raw pixel data:
/** Set the image dimensions, format and data. */
void setImage(int s,int t,int r,
GLint internalTextureformat,
GLenum pixelFormat,GLenum type,
unsigned char* data,
AllocationMode mode,
int packing=1);
Hope that helps,
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/>
303 859 9466
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Thursday, April 19, 2007 4:39 PM
To: [EMAIL PROTECTED]; osg users
Subject: [osg-users] osg::Image Questions
Hello All,
I am working on the osgDB_lwo plugin. I am trying to get it to use
transparency maps. In OSG, I know I can use the alpha channel of the color
map to provide a transparency map. In LightWave, there is a seperate
grey-scale image that is used as the transparency map. In the current
implementation of the plug-in by Marco Jez, that block is ignored.
I have it to the point in the code where I know about both blocks (alreadt
read in with osgDB from a file). I have two conditions:
1. There is a color map. In this case, I need to grab the transparency map
and place its grey value in the alpha channel of the existing color map.
2. There is not a color map, but only a base color. Here I create the
color map by placing the grey value of the transparency map in the alpha
channel and I set the RGB values to the base color.
I have a pretty good idea how to do this if the images were already 32 bit
BGRA or whatever. I am not as secure working with the other image types,
like if there is not already an alpha channel, or if the thing is using
grey-scale or an indexed color. Should I create a new image and fill it or
can I use the rescale function to change it? I am not sure how to create an
image from scratch without reading it from a file. I am not sure about how
to read and write values to and from the images (except for the 32 bit case,
I got that). Any help would be appreciated. Any reference materials I
could read? Gatchas I should watch out for?
Thanks in advance for any help,
-- Rick
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/