Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Chaucer

procedurally generated textures in d3d

This topic is 5540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!