Sign in to follow this  
sipickles

Loading resources in the background - nuts n bolts

Recommended Posts

Hi, After reading JJs post here: http://www.gamedev.net/community/forums/topic.asp?topic_id=418750 about using a second thread to load a texture, I was wondering if anyone cared to elaborate? I want to load textures using worker threads, then pass the data to the main D3D9 thread to use with D3DXCreateTextureFromFileInMemory(). Firstly, how do I load the texture manually in the worker thread (I always used the D3DX utilities before)? Secondly, how do I know the size of the file to give to D3DXCreateTextureFromFileInMemory? I am using D3D9 with MSVC2005. Thanks

Share this post


Link to post
Share on other sites
You can use 'fopen', 'fread' etc. (or any other file reading functions). Just read the entire file content into memory (one fread). You can find the size of the file using _fstat (which you'd probably use to verify it exists first) or using fseek to get to its end then ftell to get the location.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this