PDA

View Full Version : [D3D] How to reset texture blending settings



chronozphere
09-12-2006, 01:23 PM
Hi 8)

I am experimenting a bit with texture blending. :)
I want to draw some texture blended primitives and some normal ones.
So i need to reset all the texture-stage-states to their default values when drawing the normal primitives.

This is my code:

D3D.SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_ TEXTURE);
D3D.SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_S ELECTARG1);
D3D.SetTextureStageState(1,D3DTSS_ALPHAARG1,D3DTA_ TEXTURE);
D3D.SetTextureStageState(1,D3DTSS_ALPHAARG2,D3DTA_ CURRENT);
D3D.SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_M ODULATE4X);



What are the default texture-stage-state valeus??

cronodragon
09-12-2006, 03:03 PM
What about using GetTextureStageState and storing the values when the device is created.

chronozphere
09-12-2006, 05:21 PM
Good idea... I have checked the return values and i've build this procedure: :)


procedure TBF_CustomGraphic.ResetTextureBlending;
begin
with fD3DDevice do
begin
SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELEC TARG1);
SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXT URE);
SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURR ENT);
SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODUL ATE);
SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXT URE);
SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURR ENT);

SetTextureStageState(1,D3DTSS_ALPHAOP,D3DTOP_DISAB LE);
SetTextureStageState(1,D3DTSS_ALPHAARG1,D3DTA_TEXT URE);
SetTextureStageState(1,D3DTSS_ALPHAARG2,D3DTA_CURR ENT);
SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_DISAB LE);
SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXT URE);
SetTextureStageState(1,D3DTSS_COLORARG2,D3DTA_CURR ENT);
end;
end;