Jump to content
  • Advertisement


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


REPOST: Simple ole texture ops

This topic is 5760 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 trying to figure out just plain ole pre-Vertex Shaders texture operations in DirectX. Specifically, I can''t really seem to get a grip on the overall concept of SetTextureStageStage(). I looked at a tutorial from Drunken Hyena, but I just need a "Okay, there are 3 steps you need to look at. 1. Choose an operation, e.g. D3DTSS_COLOROP 2. Choose your first argument, e.g. D3DTA_TEXTURE etc etc." I see in the tutorial: g_d3d_device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1); g_d3d_device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE); g_d3d_device->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1); g_d3d_device->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); Specifically, I don''t understand D3DTOP_SELECTARG1. Generally, I don''t get the concept.

Share this post

Link to post
Share on other sites
ok. SELECTARG1 just tells d3d to select the first argument as the the input.
If SELECTARG1 is passed in along with ALPHAOP, then it means select the first argument to get the alpha value. If SELECTARG1 is passed in along with COLOROP, then it means select the first argument as input for color. Similarly using SELECTARG2 would select the second argument, and MODULATE would mix the first and second argument.

now to set the first and/or seconf arguments, you again use texture stages. to set ARG1 you do
SetTextureStateState( 0, D3DTSS_ALPHAARG1, D3DTOP_TEXTURE );
that means the the first argument for alpha is the texture, which means that direct3d will fetch the alpha values from the texture. Then if you did this
SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTOP_DIFFUSE );
it would tell d3d that the second argument for color input is the diffuse color of the vertices.

now if you want those arguments to take effect you do something like
SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 )
which tells d3d that you want alpha values taken from argument 1, and argument one takes it''s value from a texture, so now your alpha values are coming from a texture.

makes sense?

:::: [ Triple Buffer V2.0 ] ::::

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!