AUX_RGBImageRec not recognized?!

davecom
Unregistered
 
Post: #1
AUX_RGBImageRec *LoadBMP(char *Filename);

This prototype and the function delclaration itself draws a syntax error before "*" symbol. Isn't AUX_RGBImageRec a standard OpenGL type?
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #2
No. It sounds like some windows-only glaux thing.
Replace your windows-specific code with Quicktime or NSImage.
Or use libpng/jpg/tiff if you have to be cross-platform.
There is plenty of sample code in this forum showing how to load images in GL, just search.
Quote this message in a reply
davecom
Unregistered
 
Post: #3
Sorry, again I was just following the tutorial. You're right it was a Windows specific thing. I guess I'll just learn how to do tga loading.
Quote this message in a reply
Member
Posts: 72
Joined: 2006.10
Post: #4
I've read this a couple of time, and I have to make the following statement at least once:

Why, Oh why use TGA files ? Sooner or later, you will be stuck by the file sizes. If you need the alpha channel ( usually the reason people use TGA ), you are way better off using PNGs. They take around 7 lines of code to load into a GL texture in Cocoa, and if you need cross-platform compatibility, libpng will do the work nicely.

I understand that most tutorials show how to load TGAs, since it's a relatively easy task, but I, personnaly, advise against it.

- Sohta
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #5
Agree. Do NOT use targa format.
Quote this message in a reply
davecom
Unregistered
 
Post: #6
I really only want to use methods built in to the standard C/C++ API and GLUT/OpenGL, not to venture into other third party libraries. Is there a way to load PNGs/GIFs/JPEGS easily using these libraries?
Quote this message in a reply
Member
Posts: 72
Joined: 2006.10
Post: #7
Yes, but it's a LOT of trouble ( except for GIFs ). I'm not incredibly familiar with PNG's compression ( ironic since it's the only format I use ), but uncompressing jpegs imply doing a bidimensionnal inverse fourrier transform... Sad

Edit: Potential nonsense: it could be a unidimensional IFT, I'm not sure anymore

You would be stuck with gifs : paletted images with a 1 bit alpha channel.

I HIGHLY suggest you go the Cocoa way. You only need one file of obj-c++ in your whole project, it will save you hours of trouble, you will be able to load ANY file type, and the performance impact is minimal ( negligeable ). NSBitmapImageRep is a wonderfull class, worth linking to cocoa just for it IMHO . Unless you are going for multi-platform at all costs, of course.

- Sohta
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #8
QuickTime is also good:
* opens any image format (in std C, a bit more work than Cocoa)
* gives the bits to you in GPU-native ABGR order (unlike Cocoa)
* gives the bits to you with unpremultiplied alpha (unlike Cocoa)
* you can use/read from a GWorld repeatedly (unlike an NSBitmapImageRep)
* is cross-platform, at least on Windows (unlike Cocoa)
Quote this message in a reply
davecom
Unregistered
 
Post: #9
I'll stick with TGA for now, but thanks for the info.
Quote this message in a reply
Post Reply