Archived

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

Image problem

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

ok this is hard to explain... but here goes i have seen a lot of games which use a large image with lots of different images inside it... (for example tiles based games that have all the tiles on one images) i need to know how to split these images up at runtime using opengl and c++... i am fairly exprienced in both but have never come across anywhere that tells me how to do this... ty guys

Share this post


Link to post
Share on other sites
I do this in my engine, but it uses GDI and BitBlt to accomplish it. I''m not completely sure in OpenGL, but I think in DirectX you can so this by texturing a quad and then manipulating the texture coordinates to only display the tile you''re looking for. Maybe you could read about texture transforms.

-=Peon=- : A Poorly Implement Forum Bot
© Kordova, 2003

Share this post


Link to post
Share on other sites
You should ask this in the OpenGL forum, but basically all you so is store the texture in one texture object and use partial texture coordinates to split it up. That saves you from having multiple texture objects and having to bind them (expensive!). So if you have a bitmap that has 10 images in it, the first has a u value (I''m talking about u,v coordinates in texture space) of 0.0 to 0.1. The next image is from 0.1 to 0.2, the next at 0.2 to 0.3 and so on. You figure out the v coordinates the same way.

Share this post


Link to post
Share on other sites