Texture mapping works winxp, linux, not osx

Started by
2 comments, last by Shiny 16 years, 7 months ago
I'm working with a team on an opengl cross-platform side scroller. We're loading in a bmp with fopen/fread. Grabbing the width/height fine, bpp and planes to a struct. Then we fseek to the data and fread in width * height * 3 bytes 1 time for the data. Basically, this method works perfectly on both windows and linux, but when we try to compile and run our app on mac we just get a white gl_quad. The file opens fine/without error so we're struggling to figure out what's up and we thought we'd ask here to see if there's any known issue with this method on osx (g5 based) before we get too deep into debugging. Thanks.
Advertisement
Just applying a texture to a quad sounds to simple to be a bug.
If it was a bug, then other games would show the same behavior. Try some of the samples from the red book to see.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Are you sure it's not caused by the G5 being big endian? Or some memory alignment mismatch?
I think pointer hit your problem on the head. I'll leave this netrino article to explain about endianness -- no sense in regurgitating something that is already written down :)

Meanwhile, while we're on regurgitating things -- while writing an image loader is good practice...there are libraries to help you do this. I like DevIL, though it is licensed under LGPL which may not suit your purposes.

hth,

~Shiny
------------'C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg.' -Bjarne Stroustrup

This topic is closed to new replies.

Advertisement