// Gotta turn this off here, or we die
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 0);
// Turn all the other stuff back on
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glEnable(GL_CULL_FACE);
// Reset the blending function to its previous state
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}

Having those shouldn't make any difference. I think the problem is the data of the bitmap is compressed. For Tiger, you will need to use the colorAt or pixelAt methods to fill in your own uncompressed buffer, but in Panther you can just use TIFFRepresentation.

i inserted the glTexParameterf function calls into the initGL function, but that did not change anything.

I am using Tiger. When you say I need to fill in my own uncompressed buffer, do you mean I need to replace [bmpRep bitmapData] with a pointer to the uncompressed data? And I can create that uncompressed buffer byt having a loop iterate through the compressed data with the pixelAt method?

The thing that confuses me is that I am able to load po2 images. Why would having uncompressed data work for npo2 images, but not be needed for po2 images?

nuero Wrote:I am using Tiger. When you say I need to fill in my own uncompressed buffer, do you mean I need to replace [bmpRep bitmapData] with a pointer to the uncompressed data? And I can create that uncompressed buffer byt having a loop iterate through the compressed data with the pixelAt method?

The thing that confuses me is that I am able to load po2 images. Why would having uncompressed data work for npo2 images, but not be needed for po2 images?

If you recompile your old projects, do they still work? I know that there have been some changes since Panther, so that may be one of them. I will admit that I'm not a huge expert on cocoa, but from my experience of OpenGL, what works for one should work for the other (excluding mipmaps) unless something else changes.

Unknown: I've been lazy before and not specified the MIN and MAX filter. It doesn't matter. It simply looks at the first mipmap, because that's the only one that's available. In fact, IIRC mipmaps aren't even available for rectangular textures. I commented out my filter designations for my water demo with rectangular textures, and it didn't change anything.

Then it is likely the same problem with Tiger that you can't just use TIFFRepresentation. (I guess that means getting the data directly is automatically the TIFF data) In that case, you will need to go into a loop and get every pixel with pixelAt.

Tiger doesn't just randomly compress NSBitmapImageRep's data without telling you. You *must* always check that you're getting the data in the expected format, though -- this behavior could change whenever Apple feels like it. If you look at the Apple sample code you'll see that they make various checks for things like whether the data is planar, whether it has 3 or 4 components per pixel, whether each component is one byte, how much padding there is at the end of each row, etc. Your code doesn't make any of those checks, so I have no faith that you're getting data in the format you're assuming you are.

Bottom line is, NSBitmapImageRep is *not* a good way to load image data for OpenGL texturing (or any other application where you care about the format of the returned data). Either ImageIO/Quartz or QuickTime will let you load the image into a buffer you've allocated, in a format you've specified. That will avoid all data format issues, and be future-proof.