Jump to content
  • Advertisement


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


Problems with textures after changing res.

This topic is 5654 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 have this problem: Recently, I decided to allow people to change the resolution, color depth, and toggle between full screen and windowed mode. I am using SDL/OpenGL, and the only way I know to do that is to destroy the current context (shut down the video), then restart it with the new settings. Of course, as expected, the textures get lost in the process. Now, the trouble is, I tried many ways to restore them, but none seems to work, which is frustrating... I have this functions:
void set_new_video_mode(int mode)
	int i;
	//first of all, destroy the current context


	//now, reload all the textures...

					texture_cache[i].texture_id=0;//force a reload




And this:
//get a texture id out of the texture cache

//if null, then reload it (means it was previosly freed)

int get_texture_id(int i)
    int new_texture_id;
    unsigned char alpha;

            //our texture was freed, we have to reload it

        	new_texture_id=load_bmp8_fixed_alpha(texture_cache[i].file_name, alpha);
    return texture_cache[i].texture_id;
The get texture id function is called whenever drawing an object, so the textures should be reloaded... Do you spot any mistakes here? This is killing me, BTW... Height Map Editor | Eternal Lands | Fast User Directory

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!