opengl cg program binding problems
i've recently added cg shaders to my engine, it works perfectly for the direct3d part of my engine, but i can't make it work properly on the opengl side.
the problem is, that it seems that i fail to switch between the programs properly (bind).
for example:
i load one VertexProgram and one FragmentProgram that does simple coloring,
then i load one Vertex Program and one FragmentProgram that does basic texturing.
the last loaded VertexProgram still stays even after i try to bind the new one -
this is what i do to bind:
/////////////////////////////////////////////////////////////////////
bool CShaderVertexProgram_GL::Bind(CShaderUniforms* pShaderUniforms)
{
cgGLBindProgram(m_Program);
//... here i deal with uniform and autouniform, irrelevant...
cgGLEnableProfile(g_VertexProfile);
return true;
}
////////////////////////////////////////////////////////////////////////
i do the same for FragmentProgram
i tried also switching the order of bindprogram / enableprofile still doesn't work.
can anyone here PLEASE tell me what i'm doing wrong? it's really driving me mad :(
Try:
cgGLBindProgram(m_Program);
cgGLEnableProfile(g_VertexProfile);
//... here i deal with uniform and autouniform, irrelevant...
That's how I do it. Also one should of course check the values of m_Program and g_VertexProfile.
~SPH
i already tried that ... :(
and the values of m_Program and g_VertexProfile look ok,
m_Program is 0x00000001 and g_VertexProfile is CG_PROFILE_VP40 (i got it by getting latest).
another weird thing is that i manage to get parameters from the program i bind (by doing things like:
"cgParam = cgGetNamedParameter(m_Program, pUniform->m_pchName);")
but the bound vertex program isn't USED (the fixed pipeline is used in the vertex processing) but for the fragment programs it DOES work and the bound fragment program is used...
and the values of m_Program and g_VertexProfile look ok,
m_Program is 0x00000001 and g_VertexProfile is CG_PROFILE_VP40 (i got it by getting latest).
another weird thing is that i manage to get parameters from the program i bind (by doing things like:
"cgParam = cgGetNamedParameter(m_Program, pUniform->m_pchName);")
but the bound vertex program isn't USED (the fixed pipeline is used in the vertex processing) but for the fragment programs it DOES work and the bound fragment program is used...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement