Jump to content
  • Advertisement
Sign in to follow this  
Viper173

OpenGL Skinning

This topic is 5456 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Like the example in the Cg_Toolkit manual I wanted to do skinning by passing the bone Matrices to the vertex shader and multiply them with the vertices using the gpu. Nvidia uses the following constant in the shader: uniform float3x4 boneMatrices[30] What would be an appropriate OpenGl_Cg call in my opengl program to set this parameter each frame?

Share this post


Link to post
Share on other sites
Advertisement
hey,

well iv just implemented Cg Skinning, and this is the code i use to send bone matricies to the shader.


CGparameter CgCurr;
for(v=0;v<TotalBones;v++)
{
CgCurr=cgGetArrayParameter(CgBoneMatrices,v);
cgGLSetMatrixParameterfc(CgCurr,&bone[v].mat[0][0]);
}

thats what i use before every render to update the bones to the GPU.

hope it helps

Share this post


Link to post
Share on other sites
ahhh,

cgGetArrayParameter

is the equivalent to the

cgGetNamedParameter(cg_Program,'bonematrices');

call I used. So I am binding the parameter wrong.

thanx

Share this post


Link to post
Share on other sites
nono, its not the equivilant to

'cgGetNamedParameter(cg_Program,'bonematrices');'

the syntax is

'cgGetArrayParameter(CGparameter Param, int index);'

where Param is the parameter that
'cgGetNamedParameter(cg_Program,'bonematrices');'
would return.

and index is the array element like 'bonematrices[index]'

what it does is return another parameter representing an individual element of an array, from the original parameter.

so in my code u still need to get the parameter name eg.

'CgBoneMatrices=cgGetNamedParameter(cg_Program,'bonematrices');'

sorry for any confusion.


and sorry, i tried to use 'cgGLSetMatrixParameterArray()' and it didnt work for me so i cant help u there.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!