XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Multiple-texture render problem

Last post 6/29/2009 11:21 PM by legalize. 3 replies.
  • 4/16/2009 9:57 PM

    Multiple-texture render problem

    Hi! I've been trying to render 2 textures on a squad (actually to take the alpha value of the first texture and to apply it to the second one). (this is what i want to do: http://www.gamedev.net/reference/articles/article2238.asp).
    I have a small problem here... i have the same problem described here: http://www.gamedev.net/community/forums/topic.asp?topic_id=372098.
    Instead of showing the second texture details, it shows the dominant color of the texture (the alpha blend works fine, it's just that the colors are wrong)
    heres my lines of code that i'm using:
                motorGrafic.TextureState[0].AlphaOperation = TextureOperation.SelectArg1; 
                motorGrafic.TextureState[0].AlphaArgument1 = TextureArgument.TextureColor; 
                motorGrafic.TextureState[1].ColorOperation = TextureOperation.SelectArg1; 
                motorGrafic.TextureState[1].AlphaOperation = TextureOperation.SelectArg1; 
                motorGrafic.TextureState[1].ColorArgument1 = TextureArgument.TextureColor; 
                motorGrafic.TextureState[1].AlphaArgument1 = TextureArgument.Current; 
     
                motorGrafic.SetTexture(0, mudTex); 
                motorGrafic.SetTexture(1, tigerTex); 

    I don't know what's wrong... i have the latest version of DirectX SDK......any help pls...
  • 6/29/2009 3:23 PM In reply to

    Re: Multiple-texture render problem

    When you configure a texture stage, you have to configure both the alpha and the color for it to work properly.  On stage 0, you're only configuring the alpha.

    Take a look at Chapter 11. Basic Texturing from my book The Direct3D Graphics Pipeline, it covers all the details of configuring the fixed-function texture stages.

  • 6/29/2009 8:27 PM In reply to

    Re: Multiple-texture render problem

    If you don't give these renderstates a value they will have the value you previously set on them or the defaults if you haven't ever assigned a value to them.
  • 6/29/2009 11:21 PM In reply to

    Re: Multiple-texture render problem

    Yes, they retain the values previously set on them.  However, it is best not to rely on defaults because unfortunately some drivers just get it wrong.  Its better to be explicit.  Its only two texture stage states here, not a costly operation.
Page 1 of 1 (4 items) Previous Next