Flushing terrain cache?
by James Holmes · in Torque Game Engine · 10/25/2002 (10:43 am) · 3 replies
I'm working on a day/night cycler which blends a series of light maps. Everything works pretty OK, (or rather as well as it can with this technique)
Once I've prepared a new lightmap I flush the cached terrain texture maps with:-
a) Is that the correct way to flush the cache?
b) Are there some implications that I should be aware of? memory leaks etc. (I know about the one time cpu hit and I'm trying to manage that to the extent where it will be unnoticible.)
James
Once I've prepared a new lightmap I flush the cached terrain texture maps with:-
for (int i=0; i < AllocatedTextureCount; i++) {
if (TerrainRender::mTextureGrid[i]) {
TerrainRender::mTextureGrid[i]->handle = NULL;
}
}a) Is that the correct way to flush the cache?
b) Are there some implications that I should be aware of? memory leaks etc. (I know about the one time cpu hit and I'm trying to manage that to the extent where it will be unnoticible.)
James
About the author
#2
Thanks
10/25/2002 (11:50 am)
James, I'm sure there are many people who would be interested in how you achieve your day/night cycles. Is there any chance you could post a description as a resource? I'm sure many people (myself included) would be most grateful for this!Thanks
#3
Thanks for the lead, I was not aware of that call. I just want to check if it does not chuck out all textures, including those on models and interiors. I had forgotten about textures in the video card, which flushtexturecache() deals with, time to learn some OpenGL I guess.
BTW I saw this interesting statement in that code
postTextureEvent(BeginZombification);
Mike
Sure I'll post a resource. I still need to add a changing skybox and try to optimize a little. I've no need for interior lighting yet so thats for a later time but my guess is that the techniques are just about the same as for the terrain.
James
10/25/2002 (12:54 pm)
StuartThanks for the lead, I was not aware of that call. I just want to check if it does not chuck out all textures, including those on models and interiors. I had forgotten about textures in the video card, which flushtexturecache() deals with, time to learn some OpenGL I guess.
BTW I saw this interesting statement in that code
postTextureEvent(BeginZombification);
Mike
Sure I'll post a resource. I still need to add a changing skybox and try to optimize a little. I've no need for interior lighting yet so thats for a later time but my guess is that the techniques are just about the same as for the terrain.
James
Associate James Urquhart
flushtexturecache();
(That flushes the whole texture cache in script)