Jump to content
  • Advertisement


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

Dr Pain

Deleting and replacing textures

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

There sure seems to be a lot of terrain questions lately. Here''s mine. I use an array of patches for my terrain, and move them around as the user walks. I need to be able to replace the texture on these patches when they move. I''m currently doing this (simplified for readability):
   terrainTexture = PR_LoadTexture(textureName);
   PR_Globals.PR_Materials[terrainMaterial].texture_number[0] = terrainTexture;
However, after a short while, it crashes in the render routine, in PR_DrawSegmentBuffer. If I remove this texture-replacing code, it runs happily all day. Is this the correct way to replace a texture, or is there perhaps a way to directly replace the bitmap of a texture without deleting it first? Does anyone know why this would crash?

Share this post

Link to post
Share on other sites
More info:

I removed the PR_DeleteTextureByIndex call so it just keeps loading in more textures, and eventually my camera object gets trashed (overwritten). I''ve got a total of 48Meg of terrain textures at the moment, so I could be running out of RAM, but I would expect PR_LoadTexture to fail gracefully if this were the case, and even more likely to be hitting the swap file and therefore keep running, but at a much slower rate.

Chris, any ideas?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!