Library glaux?


I’m sorry but I don’t speak vera good english.

I’m juste a question: is the library glaux is portable? Can I use it with an another OS?

Thank you for your help!

Best regards

Nobody know?



Dont do it!

glaux is poo - i had all sorts of problems with it. also it is not as easy to get hold of as other API’s

if you have to use something higher than glu
then use glut.

And if you want an image loader,
then do it yourself !


Thank you for your answer!

But the glaux is portable? We can change OS after use glaux?



Glaux is Windows only.
For portability, use glut. The problem with glut is that you don’t have functions to load images. That’s why I wrote that you’ll have to implement that yourself.
If you want, I can send you some code for a bitmap or a TGA loader (even commented in french if you’d like ).


Thank you very well for your answer…

OK! glaux is only for windows! (A person said me that he saw glaux in Linux???) Now it’s doesn’t existe… but before, glaux existe in Linux!?!

Yes I search code for load texture with glut! But for tga file, because bmp is not portability.
I take the nehe code for tga file, but I find it’s diffucult for me now… and I don’t understand very well english!

If you have code in french it’s better for me ( )! But I don’t want to take your time!

Thank you a lot for your time and your answer!

You have my e-mail address in my profile!

Best regards

Here’s some code to parse a TGA…A portion of the targaParseTarga() is irrelevant, but I suggest leaving it in anyway. So, here’s the deal with this code: It doesn’t support the developer and extension areas of a targa, but you run targaParseTarga() with the filename, and suddenly, the whole file is organized in a nice struct that you can use. Call targaFreeImageColorMapData() to free up memory allocated for the image and color map buffers. I think this version has a little targaCreateTexture2D_BGR…but this has a requirement. Texture must be 24-bit in BGR format, which most TGA’s are. Here ya go:


typedef struct {
char cIDLength;
char cColorMapType;
char cImageType;
struct {
short sFirstEntryIndex;
short sColorMapLength;
char cColorMapEntrySize;
} ColorMapSpecification;
struct {
short sXOrigin;
short sYOrigin;
short sImageWidth;
short sImageHeight;
char cPixelDepth;
char cImageDescriptor;
} ImageMapSpecification;
} TGAFileHeader_t;

typedef struct {
char* pImageID;
char* pColorMapData;
char* pImageData;
} ImageColorMapData_t;

typedef struct {
long lExtensionOffset;
long lDeveloperOffset;
char cSignature[16];
char cCharacter;
char cTerminator;
} TGAFileFooter_t;

typedef struct {
TGAFileHeader_t TGAFileHeader;
ImageColorMapData_t ImageColorMapData;
} Targa_t;

Targa_t targaParseTarga(char* filename);

Targa_t targaParseTarga(char* filename)
Targa_t file;
TGAFileHeader_t header;
ImageColorMapData_t data;
TGAFileFooter_t footer;

FILE *stream = 0;
int nInteger = 0;
bool bNewFormat = false;
stream = fopen(filename, "rb");

fseek(stream, -26, SEEK_END);
fread(&footer.lExtensionOffset, sizeof(long), 1, stream);
fread(&footer.lDeveloperOffset, sizeof(long), 1, stream);
fread(&footer.cSignature, sizeof(char), 16, stream);
fread(&footer.cCharacter, sizeof(char), 1, stream);
fread(&footer.cTerminator, sizeof(char), 1, stream);
footer.cSignature[16] = 0x00;

fseek(stream, 0, SEEK_SET);
fread(&header.cIDLength, sizeof(char), 1, stream);
fread(&header.cColorMapType, sizeof(char), 1, stream);
fread(&header.cImageType, sizeof(char), 1, stream);
fread(&header.ColorMapSpecification.sFirstEntryIndex, sizeof(short), 1, stream);
fread(&header.ColorMapSpecification.sColorMapLength, sizeof(short), 1, stream);
fread(&header.ColorMapSpecification.cColorMapEntrySize, sizeof(char), 1, stream);
fread(&header.ImageMapSpecification.sXOrigin, sizeof(short), 1, stream);
fread(&header.ImageMapSpecification.sYOrigin, sizeof(short), 1, stream);
fread(&header.ImageMapSpecification.sImageWidth, sizeof(short), 1, stream);
fread(&header.ImageMapSpecification.sImageHeight, sizeof(short), 1, stream);
fread(&header.ImageMapSpecification.cPixelDepth, sizeof(char), 1, stream);
fread(&header.ImageMapSpecification.cImageDescriptor, sizeof(char), 1, stream);

if (header.cIDLength != 0)
	data.pImageID = (char*)malloc(header.cIDLength);
	fread(data.pImageID, sizeof(char), header.cIDLength, stream);
	data.pImageID = (char*)0;

if (header.cColorMapType != 0)
	data.pColorMapData = (char*)malloc((header.ColorMapSpecification.sColorMapLength-header.ColorMapSpecification.cColorMapEntrySize)*((header.ColorMapSpecification.cColorMapEntrySize/8)+0.5));
	fseek(stream, (header.ColorMapSpecification.sFirstEntryIndex * header.ColorMapSpecification.cColorMapEntrySize), SEEK_CUR);
	fread(data.pColorMapData, sizeof(char), (header.ColorMapSpecification.sColorMapLength-header.ColorMapSpecification.cColorMapEntrySize)*((header.ColorMapSpecification.cColorMapEntrySize/8)+0.5), stream);
	data.pColorMapData = (char*)0;

data.pImageData = (char*)malloc(header.ImageMapSpecification.sImageWidth*header.ImageMapSpecification.sImageHeight*((header.ImageMapSpecification.cPixelDepth/8)+0.5));
fread(data.pImageData, sizeof(char), header.ImageMapSpecification.sImageWidth*header.ImageMapSpecification.sImageHeight*((header.ImageMapSpecification.cPixelDepth/8)+0.5), stream);

nInteger = fclose(stream);

file.TGAFileHeader = header;
file.ImageColorMapData = data;

return file;


#ifdef _gl_h
GLboolean targaCreateTexture2D_BGR(Targa_t tTarga, GLuint *pTexture);

GLboolean targaCreateTexture2D_BGR(Targa_t tTarga, GLuint *pTexture)
glGenTextures(1, pTexture);
glBindTexture(GL_TEXTURE_2D, *pTexture);

GLsizei nWidth = tTarga.TGAFileHeader.ImageMapSpecification.sImageWidth;
GLsizei nHeight = tTarga.TGAFileHeader.ImageMapSpecification.sImageHeight;

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, nWidth, nHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, tTarga.ImageColorMapData.pImageData);

return true;	

#endif // !defined _gl_h

bool targaFreeImageColorMapData(Targa_t tTarga);

bool targaFreeImageColorMapData(Targa_t tTarga)

tTarga.ImageColorMapData.pImageID = (char*)0;
tTarga.ImageColorMapData.pColorMapData = (char*)0;
tTarga.ImageColorMapData.pImageData = (char*)0;

return true;


P.S. If anyone has any pointers to give me on this code, please do. I’m always looking for suggestions on how to make things better.

[This message has been edited by jtwoods (edited 12-21-2000).]

Thank you a lot jtwoods…

I try that!

Have a happy christmas, and new year!

Best regards


I think that glaux started in UNIX and was extended by MS for their OpenGL implementation. The linux version probably do not have the bitmap loader.

If I remember correctly do glaux have some bug and “features” so everybody is using glut.