Jump to content
  • Advertisement
Sign in to follow this  
akira32

FX Composer2 How to draw a texture onto the plane

This topic is 3868 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 add geometry(the plane) in the Direct3D9 window in FX Composer2. I assign my "technique2D" to the plane, but I cannot see the texure on the plane. The "techniaue2D" is the technique of using 2D Coordinate to draw a quad with Texture in a plane. The "techniaue3D" is the technique of using 3D Coordinate to draw a quad with Texture in a plane. Could someone tell me how to solve it? That is my complete source code and FX Composer2 project: http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/%e5%85%ac%e9%96%8b/Draw2D%20Akira%20FullWindowRegion%20with%20Shader.rar bool m_bUse3D_Way=false;//<===use 3d coordinate to draw a quad bool m_bUseShader=true;//<===whether using shader The four situations of "m_bUse3D_Way" and "m_bUseShader" (true,false) is all right in my C++ program. My "technique3D" can draw successfully the plane with a texture in FX Composer2. But the "technique2D" seems to be difficult to dtaw the plane with texture. I think my seeting in FX Composer2 maybe have some problems. Could somebody download my source code and FX Composer2 project and help me to find the setting in FX Composer2 project.
texture TestBaseTexture;
sampler tex_2d = sampler_state
{
    Texture = <TestBaseTexture>;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    MipFilter = NONE;

    AddressU = Clamp;
    AddressV = Clamp;
};

float4x4 WorldViewProj : WorldViewProjection;

struct AK_VS_IN_3D
{
    float4 v4_pos_in: POSITION;            // incoming vertex pos
    float2 v2_tc: TEXCOORD0;                // incoming texture coordinates
};

struct AK_VS_IN_2D
{
    float2 v2_pos_in: POSITION;            // incoming vertex pos
    float2 v2_tc: TEXCOORD0;                // incoming texture coordinates
};

struct Ps_TC_IN {
    float4 v4_pos_prj: POSITION;
    float2 v2_tc: TEXCOORD0;
};

struct Ps_DEFAULT_OUT {
    float4 color: COLOR;                        // output color
};

Ps_TC_IN VsTexture_3D(AK_VS_IN_3D IN)
{
    Ps_TC_IN OUT=(Ps_TC_IN)0;
    OUT.v4_pos_prj=mul(IN.v4_pos_in,WorldViewProj);
  OUT.v2_tc=IN.v2_tc;
    return OUT;    
}

Ps_TC_IN VsTexture_2D(AK_VS_IN_2D IN)
{
    Ps_TC_IN OUT=(Ps_TC_IN)0;
    OUT.v4_pos_prj=float4(IN.v2_pos_in, 0, 1);
    OUT.v2_tc=IN.v2_pos_in;
    return OUT;    
}

Ps_DEFAULT_OUT PsTexture(Ps_TC_IN IN)
{
    Ps_DEFAULT_OUT OUT;
    OUT.color = tex2D(tex_2d, IN.v2_tc.xy);
    return OUT;    
}

technique technique3D {
    pass p0 {
        VertexShader = compile vs_3_0 VsTexture_3D();
        PixelShader = compile ps_3_0 PsTexture();
    }
}

technique technique2D {
    pass p0 {
        VertexShader = compile vs_3_0 VsTexture_2D();
        PixelShader = compile ps_3_0 PsTexture();
    }
}


[Edited by - akira32 on March 17, 2008 11:08:52 AM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!