Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Looking for ANSI c free BMP code

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Looking for ANSI c free BMP code

    Hey all,

    I'm looking around for some BMP loader code that fits the following criteria:

    - in the public domain
    - ANSI c, cross platform in design
    - single .c/.h
    - support for indexed, 24 and 32 bit BMP's

    I'd like to add the code to my OpenGL
    framework. I'll give credit in the docs/src
    to the author.

    Please lemmie know if you've seen something like this..

    Regards,
    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: Looking for ANSI c free BMP code

    Have you thought about using TGA format.
    There are lot's of examples of loading TGA images into opengl and most paint programs will convert any image to TGA.

    Also TGA supports a alpha channel which you will find usefull in making games.

    BMP is a Microsoft format and copy righted by them. So any thing you write to support BMP will fall under any restrictions MS puts on the BMP format.


    Originally posted by jmathies:

    Hey all,

    I'm looking around for some BMP loader code that fits the following criteria:

    - in the public domain
    - ANSI c, cross platform in design
    - single .c/.h
    - support for indexed, 24 and 32 bit BMP's

    I'd like to add the code to my OpenGL
    framework. I'll give credit in the docs/src
    to the author.

    Please lemmie know if you've seen something like this..

    Regards,
    Jim


  3. #3
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: Looking for ANSI c free BMP code

    Originally posted by nexusone:
    Have you thought about using TGA format.
    Already have that. thanks for the feedback. I just wanted to support two common
    formats without having to link in complex external libs. (jpeg, png, etc)

    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  4. #4
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Sydney, NSW, Australia
    Posts
    428

    Re: Looking for ANSI c free BMP code

    Im tired of posting my code so go to the NeHe website and basically all of his tutorials will have a good bitmap loader. If you add a VERY small amount of modifications his bitmap loader will load any quality bmp file, 16bit 24 bit etc...
    :: Sleep is a poor substitute for caffeine ::

  5. #5
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: Looking for ANSI c free BMP code

    Doesn't the width and height of the bitmap have to be of a power of two if you do it that way?

  6. #6
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: Looking for ANSI c free BMP code

    Originally posted by MrShoe:
    Im tired of posting my code so go to the NeHe website and basically all of his tutorials will have a good bitmap loader. If
    I believe they use auxDIBload which is
    ms specific. I'll check though to make
    sure - thanks for the reply.

    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  7. #7
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    Romania
    Posts
    1

    Re: Looking for ANSI c free BMP code

    I recomand you jpeglib6b from Independent Jpeg Group, it can load jpg, bmp, tga, rle,ppm ….
    If you want to decompress in memory files you have to modify the code, but it not so hard.
    It is writen in C is portable and is free.
    Full sources included.

  8. #8
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: Looking for ANSI c free BMP code

    Originally posted by jmathies:
    I believe they use auxDIBload which is
    ms specific. I'll check though to make
    sure - thanks for the reply.
    Perhaps it's even compiler specific, because I can't even get that function to work on Borland. Then again, I haven't tried linking the version of glaux.lib that comes with NeHe's Borland C++ downloads. Oh well...

    I use DevIL myself for loading images into OpenGL. You might want to check it out at www.imagelib.org but I don't believe it fits all the criteria that you're looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •