Original Post
🔒 Locked
texture information
Advertisement
If you mean that you want to access a particular texel of your texture, then you'll have to lock surface level 0 of that texture and get a pointer to the texture memory.
Locking a texture is a very slow operation that you normally do not want to do at runtime. Perhaps there is another way to accomplish what you want to do?
neneboricua
Locking a texture is a very slow operation that you normally do not want to do at runtime. Perhaps there is another way to accomplish what you want to do?
neneboricua
By the sounds of things what he wants to do is extract each texel of the texture and then adjust the height of each vertex of his texture to the intensity to that. I can't see speed being much of an issue there because it is done during the loading process... But if there are faster ways, I want to hear them aswell! :)
From my experience it's often easier to load the image yourself and access the data that way for heightmapping, as you'll typically just want to create your vertices once at startup. If you are using D3DX though, you'll have to do as neneboricua19 said and Lock() the texture. Ensure that when you load it you place it in a memory pool which can be locked though!
-Mezz
-Mezz
Mezz is right, you should load it yourself. I would use a 256-color greyscale Windows BMP, it's easy to load and get at the bits.
Quote:
Original post by neneboricua19
Locking a texture is a very slow operation that you normally do not want to do at runtime. Perhaps there is another way to accomplish what you want to do?
If the texture is D3DPOOL_MANAGED, then a lock with D3DLOCK_READONLY will just return a pointer to the system memory texture, which will be fast.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement