Jo0oker
23-06-2010 01:24:58
Hello,
i have a problem with setting constants in a vertexprogram.
This is my material:
This is my C#-Code:
My programm always crashes at this line: t.SetNamedConstant("diffuse", new ColourValue(1, 0, 0, 1));
My cg-file content is:
And finally the errormessage:
Greats,
Jo0oker
i have a problem with setting constants in a vertexprogram.
This is my material:
fragment_program Shader/Fader_FP cg
{
source Fader.cg
entry_point main_fp
profiles ps_1_1 arbfp1
}
material Sky/Sun
{
technique
{
pass
{
fragment_program_ref Shader/Fader_FP
{
}
lighting off
scene_blend add
depth_write off
texture_unit
{
texture Sun.png
}
}
}
}
This is my C#-Code:
/// <summary>
/// Einblenden
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void OnBlendInPhaseChangeEventHandler(object sender, EventArgs e)
{
Console.WriteLine("Blendin: " + (sender as ITSkyBlender).BlendPercent.ToString());
myCurrentBlending = (float)((sender as ITSkyBlender).BlendPercent / 100);
GpuProgramParametersSharedPtr t = myBillboardLight.GetMaterial().GetBestTechnique().GetPass(0).GetFragmentProgramParameters();
String progName = myBillboardLight.GetMaterial().GetBestTechnique().GetPass(0).FragmentProgramName;
t.SetNamedConstant("diffuse", new ColourValue(1, 0, 0, 1));
}
My programm always crashes at this line: t.SetNamedConstant("diffuse", new ColourValue(1, 0, 0, 1));
My cg-file content is:
float4 main_fp( float4 diffuse : TEXCOORD0 ) : COLOR
{
float4 colourOut;
colourOut.r = diffuse.r;
colourOut.g = diffuse.g;
colourOut.b = diffuse.b;
colourOut.a = diffuse.a;
return colourOut;
}
And finally the errormessage:
OGRE EXCEPTION(2:InvalidParametersException): Parameter called diffuse does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\src\OgreGpuProgram.cpp (line 1097)
Greats,
Jo0oker