When the soft bodies are rendered with flat face normals,everything looks fine but when I render them with vertex normals, I see some weird artifacts in the rendering.
Here is my render function..
Code: Select all
void renderSoftbodyMeshes(btSoftBody* sBody)
{
btTransform meshTransform = sBody->getWorldTransform();
GLfloat tempForm[16];
meshTransform.getOpenGLMatrix(tempForm);
glPushMatrix();
glMultMatrixf(tempForm);
glBegin(GL_TRIANGLES);
int numFaces = sBody->m_faces.size();
for (int i=0; i< numFaces; i++)
{
// glNormal3fv(sBody->m_faces[i].m_normal); // face normal
glNormal3fv(sBody->m_faces[i].m_n[0]->m_n);
glVertex3fv(sBody->m_faces[i].m_n[0]->m_q);
glNormal3fv(sBody->m_faces[i].m_n[1]->m_n);
glVertex3fv(sBody->m_faces[i].m_n[1]->m_q);
glNormal3fv(sBody->m_faces[i].m_n[2]->m_n);
glVertex3fv(sBody->m_faces[i].m_n[2]->m_q);
}
glEnd();
glPopMatrix();
}
Please see attached video for clarification.
Thanks
W