Jump to content

  • Log In with Google      Sign In   
  • Create Account


linux 64 loadBMP in tutorials


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 index_0x0000   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 04:52 AM

First of all I want to thank about these fine openGL tutorials. Thanks! : )
I'm using 32 and 64 bit linux machines to compile ( Linux/GLX Code ). I faced with problem in loadBMP function on linux64. To be short the problem is in the following line ( starting from lesson06 ):
long int bfOffBits;
and later in the function
if (!fread(&bfOffBits, sizeof(long int), 1, file))
it's better to replace it with
int bfOffBits;
... 
	if (!fread(&bfOffBits, sizeof(bfOffBits), 1, file))
because:
linux32: sizeof( long int ) == 4
linux64: sizeof( long int ) == 8
and BMP file format assumes the field size ( File offset to Pixel Array ) to be 4 bytes.

Please correct me if I'm wrong.
Best regards.

Sponsor:

#2 rip-off   Moderators   -  Reputation: 6874

Like
0Likes
Like

Posted 02 August 2011 - 05:18 AM

From a quick Google, the type should be unsigned to start with.

It is better to replace it with a type that will always be 4 bytes, as there is no guarantee that an "unsigned int" will be this size. An example would be something like uint32_t.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS