Skip to main content
gamedev.net
🔒 Locked

Texture Loading

Started by Galileo430 Aug 10, 2001 at 10:35 PM 4 replies 500+ views
Original Post
Galileo430
Galileo430
I was just wondering if anyone knew how to load a texture useing just a whole bunch of RAW RGB data and IDirect3DTexture8. Prefably without D3DX.
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Boki
Boki
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.
We are boki. The rest is known.
Galileo430
Galileo430
thx
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Orbitalx
Orbitalx
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
Boki
Boki
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.
We are boki. The rest is known.
Orbitalx
Orbitalx
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.