PDA

View Full Version : .bmp files in Unix



11-29-2002, 03:44 PM
Does Unix environment, specifically netBSD, support .bmp files? If I were to write some code on my PC with Windows 2000 loading a .bmp, would it work on Unix?

jmg
11-29-2002, 04:38 PM
What library are you using to load in the .bmp? Is that library available on NetBSD?

nexusone
11-29-2002, 06:21 PM
If you write the BMP loader yourself yes, but if it is someone else loader would have to check it for windows only code.

It is best to use TGA format, since it is supported by both. Also TGA gives you alpha channel support.


Originally posted by Texture maniac:
Does Unix environment, specifically netBSD, support .bmp files? If I were to write some code on my PC with Windows 2000 loading a .bmp, would it work on Unix?

jpummill
11-29-2002, 08:30 PM
I just went through this with the .tga loader from nehe's web site.

It wouldn't work on a Sun machine because Sun uses a "big endian" architecture and .tga's are saved as "little endian - read X86".

jpummill

11-30-2002, 09:48 AM
And what are these .ppm files? Why can't I view them on my PC? Will a .ppm file loader on a PC work on Unix? Why did the OpenGL guys make it so hard to load textures?

12-01-2002, 07:19 AM
Ok, I loaded a texture from a .ppm and was able to display it. Now managing multiple textures...

Gavin
12-02-2002, 03:53 AM
Open gl doesn't make loading a texture hard! You can view ppm on a pc if you have a pc ppm image viewer.
Load multiple ppm's for multiple textures!

Deiussum
12-02-2002, 05:24 AM
You can't really say that a well-known image format is only supported on <insert desired OSes here>. If the spec for the image is known (as it is for BMP, TGA, etc.), it's possible to write a loader for ANY os. If you run into the case where the image is stored as litte-endian, but your architecture is big-endian (or the other way around), well.. just flip the bytes yourself when you load it in or save it in code .

[This message has been edited by Deiussum (edited 12-02-2002).]

Miguel_dup1
12-02-2002, 09:49 PM
Well, you will always run into compatilbility issues when you are reading information on different architectures.
One reads the bits in the opposite direction from the other...
The way to do this is to simply have an if defined statement like
#ifdef WIN32
{
load little endian.
}
#else
{
load big endian.
}

This is only an example.

Here is a good link. http://www.cs.umass.edu/~verts/cs32/endian.html

[This message has been edited by mancha (edited 12-02-2002).]