Sign in to follow this  

Loading sprites from a large image.

Recommended Posts

CodeZero    138
OpenGL is what I'm using. In the past I've loaded all my images in RAW format. The fact that it's a BMP shouldn't matter though, since I can convert it into RAW. I'm guessing that there are OpenGL specific routines that will access certain areas of the data once it's loaded in.

Share this post

Link to post
Share on other sites
opprobriumark    122
Load the bitmap into memory using auxDIBImageLoad (found in glaux.h). Note that you may be restricted to only using bitmap files whose dimensions are powers of 2. This depends on your machine and the version of OpenGL you are using.

You can generate a texture which provides access to the whole bitmap using glGenTextures and glTexImage2D. glIsTexture is a useful function if you would like to see if texture generation was successful.

You can then bind regions of your bitmap to a vertex using glTexCoord. (NOTE: I find it better to use glTexCoord3f because the integer version will differ depending on filesize whereas floats always range from 0 to 1 and don't depend on file-size)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this