Sign in to follow this  

Loading sprites from a large image.

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

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
LOAD INTO MEMORY
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.

GENERATE TEXTURE
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.

BIND TEXTURE COORDINATES TO VERTICES
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)

Mark

Share this post


Link to post
Share on other sites

This topic is 4534 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.

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