Skip to main content
gamedev.net
🔒 Locked

Skinning

Started by Viper173 Oct 12, 2004 at 2:42 PM 4 replies 1.9k views
Original Post
Viper173
Viper173
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?
Twixn
Twixn
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{
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
I am Me...you cant argue with THAT can you!!!
Viper173
Viper173
ahhh,

cgGetArrayParameter

is the equivalent to the

cgGetNamedParameter(cg_Program,'bonematrices');

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

thanx
Viper173
Viper173
Heeeeelp!!

doesn't work either.

Doesn't anyone know how to use the

cgGLSetMatrixParameterArray functions?
Twixn
Twixn
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.
I am Me...you cant argue with THAT can you!!!
Viper173
Viper173
thanx anyways

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.