Advertisement Jump to content


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


Preloading DirectX Textures?

This topic is 5437 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 was wondering how exactly do you preload the textures I noticed there is a preload() function for the directx texture's but im not sure how it works? Does anyone know how to implement a simple preloading for textures and mesh objects? I looked in the SDK and I couldn't find any examples of it. I'd like to beable to figure it out mainly because it seems as if it takes forever for my game to start [edited by - DevLiquidKnight on March 4, 2004 2:38:33 PM]

Share this post

Link to post
Share on other sites
It is nothing to do with pre-loading the texture from a file, it is preloading the texture into video memory (or AGP memory). You may call it when you want to tell the driver that you are about to use the texture. To speed up your game starting perhaps you could consider using compressed textures e.g. dds files

Share this post

Link to post
Share on other sites
AAAHHH!!!! So you''ve read my thread? Then HELP ME!!!!

But in an attempt to actually help someone else out...

My current program is set up with two threads. One is the "scheduler/resource manager" and the other is the "renderer".

The scheduler analyzes what things are going to be needed in the near future. In my case, it is slide show pages, text, logos, etc. In your case it may be models and textures in a 3D world. My stuff has a schedule file that I use to figure out when a certain page or logo is going to be needed. You might use such things as current player''s distance from an object. When an object is within range, I create an instance of a c_Renderable class, and load the resources associated with it.

That was all in the scheduler thread. In the renderer thread, all I do is look through the list of all c_Renderable objects that are currently loaded, and use only the ones that are active. Some already have resources loaded, but they aren''t active yet. So taking all the active c_Renderables, I draw them, and then I repeat the whole process, in a loop.

If you did something similar, then you could imagine your game start rendering instantly, but since you have no loaded resources, you have a black screen. However, as the scheduler thread loads each resource, the renderer thread picks up on it whenever the next frame comes around, and draws every available and active object. So you could start playing the game after only the most critical nearby objects have loaded, and then continue playing as less important ones continue to get loaded in the background. And even better, as you move around, some resources fall out of range, and get unloaded, while new resources will get loaded a little bit before they actually get seen. This is probably similar to the implementation in Dungeon Siege.

Of course, my examples have sort of been assuming a typical 3D game. Tetris of course shouldn''t need such an implementation. I don''t know what sorta game(s) you''re currently working on, but maybe this explanation will help.

int main() { return *((int*)0); }

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!