Sign in to follow this  
dev578

What to do if a card doesn't support dynamic textures

Recommended Posts

For my games font, I have been making a dynamic texture, and locking it to gain access to the bits. I load in the font data from a custom .font file, and then pull the characters out by their uv coords. Up until now this has been somewhat brilliant, and faster than using the DirectX font. I have a problem though, some of the computers I have tested on don't support dynamic textures. How do I get around this on these computers? I don't see any way of manipulating the bits of the texture if it is not dynamic, although it has to be possible, D3DXCreateTextureFromFile() does it somehow, but I have yet to find how. Does anyone know how this is done? Thank you, Dev578

Share this post


Link to post
Share on other sites
Quote:
don't support dynamic textures

Do you mean you can't render to a texture, or you can't lock the texture, or both?

Share this post


Link to post
Share on other sites
I can't lock the texture unless it is created with D3DUSAGE_DYNAMIC. I am not trying to render to a texture (at least I don't think I am, I just need to have a texture in memory with my font characters which vertex buffers pull out by their texture coords). When the texture is not created by D3DUSAGE_DYNAMIC, LockRect() fails. The dilemma is that some computers don't support the creation of dynamic textures.

Dev578

Share this post


Link to post
Share on other sites
Hmm, it seems to be working when creating the texture in the managed pool. Sorry, I guess I jumped the gun on this one, this was all on MSDN.

Share this post


Link to post
Share on other sites
Quote:
Original post by dev578
I can't lock the texture unless it is created with D3DUSAGE_DYNAMIC. I am not trying to render to a texture (at least I don't think I am, I just need to have a texture in memory with my font characters which vertex buffers pull out by their texture coords). When the texture is not created by D3DUSAGE_DYNAMIC, LockRect() fails. The dilemma is that some computers don't support the creation of dynamic textures.

Dev578
What error code do you get returned from the Lock() call? Every texture type should be lockable, other wise you could never put data into them. It's just that locking static textures is much slower than locking synamic textures.

EDIT: Ah yes, you can't lock textures in the default pool. You need to use IDirect3DDevice9::UpdateSurface() to do that.

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