Jump to content
  • Advertisement
Sign in to follow this  
ahmadka

Need a simple pixel shader code which just draws given texture to screen/viewport ..

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

Hi all .. I need a simple shader code to use with my XNA application which just draws a given texture to the screen .. Essentially, I'm trying to do post processing, but my aim here is to not apply any post processing effect, but to just display the texture as itself ..

I tried the following pixel shader code but I'm getting some problem (explained below):

sampler textureSampler;

float4 PostProcessingPS(float2 texCoord: TEXCOORD0, float4 Position : POSITION0) : COLOR0
{
float4 color = tex2D(textureSampler,texCoord);
return color;
}

technique PostProcessingEffect
{
pass Pass1
{
PixelShader = compile ps_2_0 PostProcessingPS();
}
}


The issue I'm getting is that the entire texture is not drawn .. Only the borders are being drawn for some reason ?! And even regarding the borders, I'm not sure if they are being drawn properly .. I'm just saying they are being drawn because the pixel values there change as the scene itself changes ..

This is what it should be like:



And this is what I see:


Any ideas ?

Share this post


Link to post
Share on other sites
Advertisement
What you see is wireframe of your screen quad or similar. Try changing the material type or whatever it's called in XNA. You're shader code seems fine.

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!