Jump to content
  • Advertisement
Sign in to follow this  
BenDstraw

very simple hlsl shader help

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

Hello All, it is very daunting posting here because it seems that everyone is in a league of their own but I guess we all have to start somewhere. I just finished watching HLSL fundamentals from cg academy. As part of my learning I decided to write a shader from scratch to test my understanding of how it all works. But an epic fail on my part I can't seem to even get this simple thing working right. Even though its a hard-coded color value I can't seem to get it to display anything but white :( Also I'm very new here is there any code tags I can use on my posts :P float4x4 WorldViewProj : WorldViewProjection; struct app2vertex { float4 pos : POSITION; }; struct vertex2pixel { float4 pos : POSITION; float4 color : COLOR; }; vertex2pixel vertex(app2vertex In) { vertex2pixel Out = (vertex2pixel)0; Out.pos = mul(In.pos,WorldViewProj); Out.color = (1.0,0.0,0.0,1.0); return Out; } float4 pixel(vertex2pixel In) : COLOR { float4 finalCol = In.color; return finalCol; } technique technique0 { pass p0 { CullMode = cw; VertexShader = compile vs_1_1 vertex(); PixelShader = compile ps_2_0 pixel(); } }

Share this post


Link to post
Share on other sites
Advertisement
replace


Out.color = (1.0,0.0,0.0,1.0);





with


Out.color = float4(1.0,0.0,0.0,1.0);





and the code tag is: [ source ][ /source ] (without the spaces)

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!