Texture Pixel Data

Started by
2 comments, last by Morpheus011 17 years, 7 months ago
Hi, I need to access individual pixel data for a texture so it can be altered during runtime. Is this possible? I.e. I want to start with a plain white texture, and based on events that occur during runtime, I want to increase the colour for certain pixels of the texture. Any ideas? Cheers
Advertisement
...or alternatively, is possible to define the opacity of a texture pixel by using an array?
See IDirect3DTexture9::LockRect().

Note: There is related functionality for surfaces, where each type of image (texture, render target, 3d texture, etc...) have an associated IDreict3DSurface9, but you don't need to get the surface interface to update a texture.
This sounds like a perfect opportunity to use a fragment shader. Inside your fragment shader you could determine if a given element of your texture is the color you want to be changing. You could pass in a variable from the application (not sure how this is done in HLSL) to determine if it's time to change this particular element of the texture.

This topic is closed to new replies.

Advertisement