From: Marcin Romaszewicz (marcin++at++asmodean.engr.sgi.com)
Date: 06/04/2001 09:16:56
Performer doesn't let you specify a color matrix for a texture, so you
have to be creative about how you do that :)
What you can do is supply a null pointer for the image data in
pfTexture::setImage and then subload the texture data into the texture in
a draw callback. All the other parameters to setImage, setFormat, etc,
should be correct for the data you will subload.
Your draw callback would look something like this:
glMatrixMode(GL_COLOR)
glPushMatrix();
glLoadMatrix(yourMatrix);
texture->subload(blah, blah, blah...)
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
You have to do this in the draw callback since the draw process is the
only one with a valid GLX context.
If your textures are static, it would be significantly faster to convert
them to rgba and load the rgba directly in Performer. Color matrix
operations go through the GE, which will slow down your texture download
speed.
-- Marcin
On Sun, 3 Jun 2001, Gernot Ziegler wrote:
> Hej Marcin !
>
> > Performer textures support any internal/external format that OpenGL
> > textures support. Take a look at glTexImage2D; you will be ably to use any
> > of the formats listed there and pfTexture accepts them as parameters.
> Exactly ...
>
> > Off the top of my head, I do not think OpenGL can accept YUV textures. On
> > a machine with the ARB_Imaging extensions, or any sgi hardware, you could
> > set up a matrix that will convert your texture colors with a color
> > matrix. I think that YUV or YCrCb conversion to RGB can be done with a 3x3
> > matrix. I'm sure you will find what the matrix is if you do a search on
> > the web.
> Right - I have a program available that does that in OpenGL, approx. like
> that:
> static GLfloat Matrix_YCbCr2RGB[16] = {
> 1, 1, 1, 0,
> 0, -0.344136, 1.773, 0,
> 1.402, -0.714136, 0, 0,
> 0, 0, 0, 0
> };
> // Setup YCbCr -> RGB color transform matrix
> glMatrixMode(GL_COLOR);
> if (convYUV2RGB) {
> glLoadMatrixf(Matrix_YCbCr2RGB);
> glPixelTransferf(GL_GREEN_BIAS, -0.5);
> glPixelTransferf(GL_BLUE_BIAS, -0.5);
> }
> glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
> imgWidth, imgHeight,
> GL_RGB, GL_UNSIGNED_BYTE, imgData);
>
>
> ---------------------
> But I have no clue how to translate that to Performercode - I saw that it
> is possible to load the OpenGL matrix - but can it be used for the texture
> upload, too ? Could I load the OpenGL matrix and then issue a
> tex->setImage ?
>
> I am not good at that lowlevel-stuff yet, just started for 3 weeks ago :-P
> :-)
>
> Servus,
> Gernot
>
> /-----------------------------W-E-L-C-O-M-E------------------------------\
> T The Austria <=> Sweden connection..... T
> | E-Mail: gz++at++lysator.liu.se H
> O Homepage: http://www.lysator.liu.se/~gz E
> \------------------------------F-U-T-U-R-E-------------------------------/
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
This archive was generated by hypermail 2b29 : Mon Jun 04 2001 - 09:16:59 PDT