Original Post
Hey guys, I'm trying to learn HLSL by using rendermonkey. I'm just learning how to apply a texture to a mesh, and I'm getting a compiler error in my pixel shader. I'm trying to use the "sampler" command, but it doesn't seem to like it. If I take that line of code out, it complains about my texture object not existing. Here's the listing for both my vertex and pixel shaders, and the error. Any ideas would be helpful. Thanks guys. Vertex shader: float4x4 matViewProjection; struct VS_INPUT { float4 Position : POSITION0; float2 TexCoord : TEXCOORD0; }; struct VS_OUTPUT { float4 Position : POSITION0; float2 TexCoord : TEXCOORD0; }; VS_OUTPUT vs_main( VS_INPUT Input ) { VS_OUTPUT Output; Output.Position = mul( Input.Position, matViewProjection ); Output.TexCoord = Input.TexCoord; return( Output ); } pixel shader: sampler Texture0 // I tried both sampler and sampler2D float4 ps_main(float2 TexCoord: TEXCOORD0) : COLOR0 { return( tex2D(Texture0, TexCoord)) } error: Compiling pixel shader API(D3D) /../Effect1/My Pass/Pixel Shader/ COMPILE ERROR: API(D3D) /../Effect1/My Pass/Pixel Shader/ memory(3,1): error X3000: syntax error: unexpected token 'float4' RENDERING ERROR(s): Pixel shader 'Pixel Shader' failed to compile in pass 'My Pass'. See Output window for details