Results 1 to 3 of 3

Thread: [D3D] How to reset texture blending settings

  1. #1

    [D3D] How to reset texture blending settings

    Hi

    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:
    [pascal]
    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);
    [/pascal]


    What are the default texture-stage-state valeus??
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    [D3D] How to reset texture blending settings

    What about using GetTextureStageState and storing the values when the device is created.

  3. #3

    [D3D] How to reset texture blending settings

    Good idea... I have checked the return values and i've build this procedure:

    [pascal]
    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;
    [/pascal]
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •