Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualNyssa

Posted 13 January 2013 - 03:29 AM

If you were to do it from the shader then it would have to be via the preprocessor. For example:

#ifdef USE_SKINNING
if (u_DeformerCount > 0) /// Matrix deformations.
{
      mat4 l_deformer;
                               
      for (int i = 0; i < 4; ++i) /// Maximum of 4 influences per vertex.
      {
           l_deformer += a_Weights[i] * u_XFormMatrix[a_Deformers[i]];
      }
}
#endif

 

This has the bonus of removing code that is not needed for non skinned objects and may speed up your application a little.

 

Otherwise you can do it on the CPU during your programs initialization. If you have access to the raw vertex array data before it enters OpenGL then I'd simply change the values there to zero (EDIT : or remove them entirely!). Otherwise you would need to access it from OpenGL using a function like "glMapBuffer" and changing the values from there.


#1Nyssa

Posted 13 January 2013 - 02:50 AM

If you were to do it from the shader then it would have to be via the preprocessor. For example:

#ifdef USE_SKINNING
if (u_DeformerCount > 0) /// Matrix deformations.
{
      mat4 l_deformer;
                               
      for (int i = 0; i < 4; ++i) /// Maximum of 4 influences per vertex.
      {
           l_deformer += a_Weights[i] * u_XFormMatrix[a_Deformers[i]];
      }
}
#endif

 

This has the bonus of removing code that is not needed for non skinned objects and may speed up your application a little.

 

Otherwise you can do it on the CPU during your programs initialization. If you have access to the raw vertex array data before it enters OpenGL then I'd simply change the values there to zero. Otherwise you would need to access it from OpenGL using a function like "glMapBuffer" and changing the values from there.


PARTNERS