I am reading a book about making custom filters, however when I run their code I get an error on lines
4, 5, and 14. I believe their is something wrong with how the float value is entered. I do not know c++ so if someone could could help it would be great.
The error is:
filter.cg: (4) : error C0000: syntax error, unexpected integer constant at token""
filter.cg: (4) : error C0501: type name expected at token""
filter.cg: (5) : error C0000: syntax error, unexpected integer constant at token""
filter.cg: (5) : error C0501: type name expected at token""
filter.cg: (14) : error C0000: syntax error, unexpected integer constant at token""
filter.cg: (14) : error C0501: type name expected at token""
This code is saved as a .cg file.
//Cg
void vshader(float4 vtx_position : POSITION,
out float4 1_position : POSITION,
out float2 1_texcoord : TEXCOORD0,
uniform float4 texpad_color,
uniform float4x4 mat_modelproj)
{
l_position = mul(mat_modelproj, vtx_position);
l_texcoord = (vtx_position.xz * texpad_color.xy) + texpad_color.xy;
}
void fshader(float2 1_texcoord : TEXCOORD0,
uniform sampler2D k_color : TEXUNIT0,
out float4 o_color : COLOR)
{
float4 color = tex2D(k_color, l_texcoord);
o_color = float4(color.r * 1.8, color.g, color.b, * 0.2, color.a);
}
After further research I maybe calling the shader wrong in python.
Currently my code is:
def setupPostFx(self):
self.filterMan = FilterManager(self.win, self.cam)
colorTex = Texture()
finalQuad = self.filterMan.renderSceneInto(colortex = colorTex)
finalTex = Texture()
interQuad = self.filterMan.renderQuadInto(colortex = finalTex, div = 8)
interQuad.setShader(loader.loadShader("filter.cg"))
interQuad.setShaderInput("color", colorTex)
finalQuad.setShader(loader.loadShader("pass.cg"))
finalQuad.setShaderInput("color", finalTex)
I currently get the same error in the pass.cg as the filter.cg it looks like the float# is the problem. should I be importing a specific python file at the top of the program to solve this?