Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a BMP in opengl visual cpp

I need to apply a texture in a polygon. So I searched and I found many sources but i'm most of them I had problems in include and loading BMP picture. (developing in visual cpp 10). So can anyone tell-me the easy way to load a BMP file and how to apply the texture?

like image 673
gn66 Avatar asked Aug 05 '26 10:08

gn66


1 Answers

An easy way is to use GDI+ class Bitmap:

http://msdn.microsoft.com/en-us/library/ms534420%28v=vs.85%29.aspx

You create an object with a constructor which takes a filename and then get a pointer to the buffer which contains the pixels using LockBits() method. That method gives you a pointer to a buffer which you can send to OpenGL texture functions.

like image 56
shoosh Avatar answered Aug 08 '26 00:08

shoosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!