Basic Render-Target Example
// The 4x4 world view projection matrix. float4x4 viewProjection : WorldViewProjection; sampler texSampler0; // input parameters for our vertex shader struct VertexShaderInput { float4 position : POSITION; float2 texcoord : TEXCOORD0; }; // input parameters for our pixel shader // also the output parameters for our vertex shader struct PixelShaderInput { float4 position : POSITION; float2 texcoord : TEXCOORD0; }; /** * Vertex Shader performing basic viewing transformation. */ PixelShaderInput vertexShaderFunction(VertexShaderInput input) { /** * We transform each vertex by the view projection matrix to bring * it from world space to projection space. * * We return its color unchanged. */ PixelShaderInput output; output.position = mul(input.position, viewProjection); output.texcoord = input.texcoord; return output; } /** * Pixel Shader */ float4 pixelShaderFunction(PixelShaderInput input): COLOR { return tex2D(texSampler0, input.texcoord * 5) + float4(0.2, 0.2, 0.0, 1.0); } // Here we tell our effect file the functions which specify our vertex // and pixel shaders. // #o3d VertexShaderEntryPoint vertexShaderFunction // #o3d PixelShaderEntryPoint pixelShaderFunction // #o3d MatrixLoadOrder RowMajor