Re: Help on converting image data to performer pfTexture type

New Message Reply Date view Thread view Subject view Author view

John Rohlf (jrohlf++at++tubes)
Fri, 22 Sep 95 10:37:01 PDT


>
> --
> --PART-BOUNDARY=.19509191453.ZM1341.electrogig.com
> Content-Type: text/plain; charset=us-ascii
>
> Can someone help me with the following:
>
> I generate an image that looks like a checkerboard ( as given in the
> open GL book, page 261) and use that image in pfTexImage API hoping to be
> able to map this new texture on to my geometry which is a square facing the
> user. But instead of a check image I get a solid purple square. If I change the
> number of components/pixel in the API, then I don't get anything. What am I
> doing wrong? I am enclosing a small smaple program to demo this.
>

> int i, j, r, c;
> unsigned long img[64][64][3];
>
> tex = pfNewTex(arena);
>
> xsize = ysize = 64;
>
> /* make check image : from openGL book */
> for ( i = 0; i < ysize; i++ )
> for ( j = 0; j < xsize; j++ )
> {
> c = ((((i&0x8)==0)^((j&0x8))==0)) * 255;
> img[i][j][0] = (unsigned long) c;
> img[i][j][1] = (unsigned long) c;
> img[i][j][2] = (unsigned long) c;
> }
>
> pfTexImage(tex, img, 2, xsize, ysize, 1);

        pfTexImage expects a packed image. In the above example
your image is of type 'long' but it should be of type 'char' and the
number of components you specify to pfTexImage should be 3, not 2.
I speak for IrisGL only - I don't know exactly how pfTexImage behaves
in OpenGL.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:54 PDT

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