procedurally generated textures in d3d

Started by
3 comments, last by Chaucer 20 years, 12 months ago
I''m not sure if this should be in the beginners forum or not but I''d like to create a texture procedurally without having to save it on file. I''ve seen D3DXCreateTexture() but I''m not sure how to actually change how the image looks. I was hoping someone could point me in the right direction and save me a bit of time. Thanks.
Thanks!
Advertisement
2 things you can look into...

1. Locking the texture, this will let you modify the memory directly using a pointer.
2. Using it as a render target, this will let you draw a scene onto the texture..good for reflections, mirrors etc..
I would recommend the D3DXFillTexture* routines to generate procedural textures. You can either specify a callback function for the fill routines to call for every pixel, or you can compile an HLSL texture shader for D3DXFillTextureTX to use for filling the texture.
The MetallicFlakes.fx file in the DX9 SDK (use with EffectEdit) demonstrates an example texture shader. The EffectEdit sample is a good demonstration of the C code required to use D3DXFillTextureTX

Craig Peeper
Microsoft, Direct3D

This posting is provided "AS IS" with no warranties, and confers no rights.
Craig PeeperMicrosoft, Direct3DThis posting is provided "AS IS" with no warranties, and confers no rights.
Question about D3DXFillTexture.

What is the user defined data meant for in the LPD3DXFILL2D function?

[edited by - Chaucer on April 22, 2003 11:03:25 PM]
Thanks!
The user data is data that you specify on the D3DXFillTexture call that is passed to your callback every time the callback is called. This is the standard mechanism for doing callbacks (i.e. see qsort).
Allows you to communicate information to your own callback without resorting to global variables.


Craig Peeper
Microsoft, Direct3D

This posting is provided "AS IS" with no warranties, and confers no rights.
Craig PeeperMicrosoft, Direct3DThis posting is provided "AS IS" with no warranties, and confers no rights.

This topic is closed to new replies.

Advertisement