Archived

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

Texture Loading

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

Load the raw data (obviously ), create a texture in the preferred format via IDirect3DDevice8::CreateTexture(), get a pointer to the surface using IDirect3DTexture8::GetSurfaceLevel(), lock and fill it with your data. The last step may involve some format conversion but should not be this hard to do - at least in d3d8.

Hope this helps,
Bjørn.

Share this post


Link to post
Share on other sites
Correct me if I''m wrong, but GetLevelSurfaceDesc() doesn''t return a pointer to the surface as far as I know. I think you have to call LockRect() to get a pointer to the surface, and the sad thing is, video memory surfaces can''t be locked by LockRect()

The way I''ve been doing it is creating a D3DPOOL_SYSTEMMEM texture, locking it, copying my image data to it and then calling UpdateTexture() on my video memory texture..

Am I doing this extra step for nothing?

Orbitalx

Share this post


Link to post
Share on other sites
Yup, GetLevelSurfaceDesc() does not, but GetSurfaceLevel() does The returned surface is lookable even if the texture is in D3DPOOL_DEFAULT (at least according to how I understand the docs )

Bjørn.

Share this post


Link to post
Share on other sites
I had overlooked that method, but according to testing I just did, the returned surface doesn''t seem to be lockable.

Of course, if D3D8 returned something other than that blasted D3DERR_INVALIDCALL from time to time, it would be easier to know what went wrong exactly.. But the call to LockRect failed on the surface, and I don''t feel like installing the debug version of Dx8 to find out why

Orbitalx

Share this post


Link to post
Share on other sites