Jump to content
  • Advertisement
Sign in to follow this  

Basic Texture Shader not working

This topic is 5029 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

float4x4 worldViewProj;
texture testTexture;
sampler DiffuseSampler;

struct VS_OUTPUT
    float4 Pos : POSITION;
    float2 Tex : TEXCOORD0;

VS_OUTPUT vs_main(float4 inPos : POSITION, 
	float2 inTex : TEXCOORD0 )
    Out.Pos = mul(inPos, worldViewProj);
    Out.Tex = inTex;
    return Out;

float4 ps_main( VS_OUTPUT In ) : COLOR0
    return tex2D(DiffuseSampler, In.Tex);

// Renders scene to render target
technique Technique0
    pass P0
        VertexShader = compile vs_1_1 vs_main();
        PixelShader  = compile ps_1_1 ps_main();
I make sure I pass in the texture, and update the matrix every frame, but it still doesn't work properly. My object geometrically is correct, but instead of being displayed with a texture, it's just black.

Share this post

Link to post
Share on other sites
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!