Advertisement Jump to content


This topic is now archived and is closed to further replies.


Using textures to draw terrains

This topic is 6395 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

I started reading OpenGL Game Programming (excellent book by the way), and I got a little stuck on chapter 8 with the terrain demo. Although I understand how it works, I tried to make my own terrain by making a simple grayscale 32x32 bitmap in Photoshop and loading it in. However, my program (and even the demo in the book) isn''t able to properly read the bitmap when I make it in photoshop, but it can read the terrain2.bmp that came with the demo program. Even when I edit the bitmap in photoshop and save it, it doesn''t work. But, when I edit it in Paint, it works fine. I tried editing it in photoshop and making my own in photoshop and then resaving it with Paint, but it still didn''t work. My guess is that Photoshop does something different in the bitmap header which the LoadBitmapFile() function the book gives you can''t handle (maybe RLE compression or something...) Anyway, my question: does anyone know how to either fix this in photoshop, or know of a decent graphics editing program that will work with the demo program (if you can''t tell...I really do not want to use paint to draw terrains....) Thanks

Share this post

Link to post
Share on other sites
Hmm, the bitmap function should work. Make sure that you''re saving it as a 24-bit BMP, even though it''s just gray data. The function won''t load any other type of BMP (sorry, ran out of time ).

If doing that still doesn''t work, then make another post here and if I get a chance I''ll check it out.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!