Jump to content
  • Advertisement
Sign in to follow this  
Eric Levin

hlsl and textures

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

Hey everyone!

I'm a total directx noob... How do I get shaders and textures both working on a model at once? Right now, when I enable a shader effect my texture no longer shows up...

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Your shader has to read from the texture. For instance:


struct PS_INPUT
{
float4 pos : POSITION;
float4 diffuse : COLOR0;
float2 uv : TEXCOORD0;
};

struct PS_OUTPUT
{
float4 colour : COLOR0;
};

sampler2D textureSampler : register(s0);

//-------------------------------------------------------------------------------------------------

PS_OUTPUT main(PS_INPUT In)
{
PS_OUTPUT Out;
Out.colour = tex2D(textureSampler, In.uv) * In.diffuse;
return Out;
}

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!