Brian Furtaw (brian++at++sgi.com)
Tue, 18 Mar 1997 10:52:44 -0500
You can use the OpenGL token names such as GL_UNSIGNED_SHORT_5_5_5_1_EXT for
image formats to a pfTexture node it is just not guarunteed to work in future
releases of Performer.
Brian
On Mar 17, 5:21am, Angus Dorbie wrote:
> Subject: Re: 16-bit vs. 24-bit texels for pfTex->setImage()
> There's a big difference between the internal format and the data you need
> to supply the gl. Generally the gl does all the conversion for you so yes
> you pick an internal format but you also need to create an appropriate
> array of information to match the data format the gl expects.
>
> PFTEX_EXTERNAL_FORMAT, PFTEX_PACK_8
>
> is what is supported by default and you certainly won't need more for
> what you are doing, just supply an array of 8 bit packed data in the image
> array and let the graphic system do the work. This api smacks of IrisGL
> with it's use of the external format token.
>
> There days OpenGL on the Infinite Reality supports packed external
> image data like GL_UNSIGNED_SHORT_5_5_5_1_EXT, but I don't know if
> these tokens would work through Performer, it'd be worth a try if
> you _really_ want to keep your 5 bpc host copy, but it's much simpler
> to send the 8 bit per component image and let the machine do the
> conversion work for you.
>
> Cheers,Angus.
>
>
> On Mar 16, 3:15pm, Daniel E. Small wrote:
> > Subject: 16-bit vs. 24-bit texels for pfTex->setImage()
> > Hello Performers,
> >
> > Newbie questions continued.
> >
> > I a bunch of texture data from video that I need to map. I would like
> > to conserver memory, so I want to take the 24 bit data and reduce it to
> > 16, and scale the image down by 1/2, ending up with a 320x240 16bit
> > image. (I know they are not powers of 2 but I have some complex video
> > calibration issues that I have to deal with before attempting that piece
> > of optimization).
> >
> >
> > I convert each texel component to 5 bits and shift them in the following
> > manner:
> >
> > r,g&b are ushort arrays.
> >
> > unsigned short tr;
> > unsigned short tg;
> > unsigned short tb;
> > unsigned short dest;
> >
> > tr = ((r[i]&0x00f8)>>3);
> > tg = ((g[i]&0x00f8)<<2);
> > tb = ((b[i]&0x00f8)<<7);
> >
> > dest = tr | tg | tb;
> >
> > I am 'assuming' that the bit ordering is (from lowest to highest) 5 bits
> > red, 5 bits green, 5 bits blue, and 1 bit alpha. Please enlighten me if
> > I am in error.
> >
> > I know the data is good because I am able to use this method to create a
> > texture of 32 bits in the same method; by shifting green by 8 and blue
> > by 24 and or'ing the 3 components. I am scaling down hthe 24 bit image
> > and it looks fine.
> >
> >
> > Using the above method, I step thru the original image data and create a
> > new image of 16bit texels.
> >
> > I then use setImage in the following way:
> >
> > tex = new(arena) pfTexture;
> >
> > tex->setFormat(PFTEX_INTERNAL_FORMAT,PFTEX_RGB_5);
> >
> > where imgPtr is the 16bit data.
> >
> > tex->setImage((uint *)imgPtr,2,320,240,1);
> >
> > tex->setRepeat(PFTEX_WRAP,PFTEX_CLAMP);
> >
> > The texture does appear when it is downloaded, but it has no red or
> > green components, just blue.
> >
> > I am wondering if there is another mode I need to set that I am missing,
> > or if I have made some newbie mistake.
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Angus Dorbie
-- o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-oBrian Furtaw (brian++at++sgi.com) VisSim Technical Consultant 12200-G Plum Orchard Drive Office:(301)572-3293 Fax: (301)872-3293 Silver Spring, Maryland 20904 OpenGL/ImageVision/OpenInventor/Performer ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:54 PDT