I have no mouth and I must scream

Posts: 321
Joined: 2004.10
Post: #1
Ok, I've read the Red Book and online searched for 2 days now.
I've been using RGBA targa images successfully for a long time now.
Wanted to study bump maps so dove into 8 bit targa images.
Thought it would be a breeze after using RGBA. 32 to 8 bits, right Smile

I'm at my wits end. I'm just trying to get an 8 bit (grey) Targa image into
my program. I've tweaked the RGBA code because it worked and who
wants to reinvent the wheel. I take a 256x256 8 bit targa image and
decompress into a rgba image (256*256*4 = 262144) and send it to
gluBuild2DMipmaps(). The result variable keeps getting set to a 100900 value?
The error code below the function code doesn't work!? I'm pretty
sure I got it verbatim from the Red Book. I'm running this on an old
G3 OS 9 machine (yes, yes, I'm getting a G5 imac when Tiger comes out)
and thought that maybe this isn't supported?

Anyway, I've checked and triple checked all parameters. The width and
height is 256. In desperation, I even tried setting all bytes of
the image data to zeros before the function call.

And the code does work with a 32 bit RGBA image.

Any thoughts? PS. I thought of using glTexImage2D() but there is no
return result and I wanted some "positive" reinforcement.

Is it stupid to use gluBuild2DMipmaps() with grey images?

internalFormat = GL_RGBA;
     textureDataFormat = GL_RGBA;  

     result = gluBuild2DMipmaps(
                                  GL_TEXTURE_2D,           // target
                                  internalFormat,              // internal format of texel image
                                  textureImage->sizeX,   // width
                                  textureImage->sizeY,   // height
                                  textureDataFormat,      // format of texture image data
                                  GL_UNSIGNED_BYTE,    // type
                                  textureImage->data     // texels
    if (( errCode = glGetError()) != GL_NO_ERROR)
        errString = gluErrorString(errCode);
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
You haven't shown us enough code to tell us anything. Post the Targa-loading code, put a printf or whatever above the call to gluBuild2DMipmaps showing all the parameters and tell us what gets printed, &c.

Alternatively, use QuickTime to load your images. It's easier, and you get support for every image format under the sun.

Oh -- and seriously time to upgrade Rasp
Quote this message in a reply
Posts: 321
Joined: 2004.10
Post: #3
Thanks, but I don't want to impose anymore than I already have.

I've appoached QuickTime in the past, but don't have any
examples or demos and the Apple web site's code examples
are (IMHO) pretty atrocious.

I'll just keep plugging away.
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #4

It doesn't work out-of-the-box on Mac OS 9 (the stuff for converting a POSIX path to an FSSpec is completely irrelevant, and some of the OpenGL extensions used in the movie-playing sample are not available), but most of it should be good to go.
Quote this message in a reply
Post Reply