Jump to content
  • Advertisement
Sign in to follow this  
Hodgeka

OpenGL Height map from bitmap file?

This topic is 2581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Originally, I thought this would be an easy problem to find a solution to, but after a couple of attempts and some searching around, I am at a loss. Basically what I'm trying to do is load a small bitmap file which has nothing but a single black curve on a white background. I want to use the y-values of the black pixels along the curve contained in the bitmap file to generate heights for a series of objects in my program. The problem I am having is finding a way to read in the pixel data from my bitmap file. I want to use only the OpenGL API to do this for now.

Any suggestions/tips?

Thanks,

Hodgeka

Share this post


Link to post
Share on other sites
Advertisement
Look up Devil (developers image library). There are some code samples on their site, or you can google image loader libraries (c++/c/c# whatever you are using).

Share this post


Link to post
Share on other sites
Some reading I found that might be helpful. Doesn't look like OpenGL offers native API that allows you to extract pixel data from the bitmap file directly. This first link talks of how to load a bitmap into a frame buffer and from there extract the pixel data, I didn't read the whole thing but at a glance it appears this will be what you want. The second method explains a more direct way to read the pixel data directly from the file BUT it requires using windows API (bitmaps are actually a Microsoft and Windows invention you know). Either way, hopefully this will help and get you going.

http://fly.cc.fer.hr/~unreal/theredbook/chapter08.html


http://www.dreamincode.net/forums/topic/26936-how-to-make-sense-of-the-bmp-format/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!