Re: Textures

New Message Reply Date view Thread view Subject view Author view

Phil Keslin (philk++at++cthulhu.engr.sgi.com)
Tue, 02 Feb 1999 18:05:15 -0800


Angus Dorbie wrote:
>
> You could check the file extension, otherwise you have to use libimage
> to at least load the header information.
>
> Yes the number of components in an image file will be used to determine
> the internal format of a pfTexture IF you use it's method to load the
> file.
>
> You'll still have to make sure that the transparency state is set
> appropriately in the geostate though or transparency won't be enabled
> and it'll look just like an RGB (if you have a MODULATE texture
> environment).
>
> Cheers,Angus.
>
> Roni Kass wrote:
> >
> > Some textures questions:
> >
> > 1) Is there a way to find for an SGI file (Before loading it as texture)
> > if it
> > is RGB or RGBA

After opening the file using iopen, the zsize field in the header (see
<gl/image.h>) will allow you to determine the color model. If zsize == 3
then the image is rgb and for zsize == 4, rgba. If you are using
pfTexture then you can use pfGetTexImage (or pfTexture::getImage for
C++). The comp argument will return the number of components.

> > 2) When I load a SGI file, without setting the internal format first,
> > wil it
> > know to set the internal format for rgb files to RGB and for rgba files
> > to RGBA_8 ?

For RGB it will choose (I believe) RGB5 and for RGBA, RGBA4 with the
default internal format. You can always change the internal format, you
must ensure that the texture gets reloaded (not quite sure if its
automatic). The pfTexture man page lists the defaults for various
component types.

- Phil

-- 
Phil Keslin <philk++at++engr.sgi.com>

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Feb 02 1999 - 18:05:19 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.