Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture modulation/stage questions

Started by choffstein Apr 5, 2005 at 7:37 PM 2 replies 550+ views
Original Post
choffstein
choffstein
So I am trying to create some clouds for my skydome, which are going to be colored by using a texture. These two textures (cloud and color) will be modulated. The color texture changes on time of day, and cloud texture changes using a 3d perlin-noise method. My issue is this: I set the sampler states correctly, etc, etc, but I cant figure out how to turn them OFF when I want to render with the rest of my engine. For example:

        pd3dDevice->SetSamplerState( 1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	pd3dDevice->SetSamplerState( 1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );

        pd3dDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 );

	
	//pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE ); // Modulate...
	pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_ADD ); // or Add...

	pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE ); // the texture for this stage with...
	pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT ); // the current argument passed down from stage 0

	//
	// Set the two textures to be used by our stages...
	//
	pd3dDevice->SetTexture( 0, cloudTexture->returnTexture());
	pd3dDevice->SetTexture( 1, skyTexture->returnTexture());

        //DRAW HERE



        //Okay, now how do I turn texturestage 1 off, so that the rest of the stuff in my engine draws without this wack modulation?


Basically, after everything is drawn, I want to turn off the stage 1 modulation. None of the tutorials I have cover this... Thanks!
Kibble
Kibble
Set the color operation of stage 1 to D3DTOP_DISABLED.
choffstein
choffstein
Perfect! Thanks a bunch!
hplus0603
hplus0603
You set the color and alpha operations of the texture stage state to D3DTOP_DISABLE. Note that the spec says that any stage after the first with DISABLE will also be disabled, but practice may be different, so set them all to DISABLE to be sure.
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.