Community
const VBOMesh * lMeshCache = static_cast<const VBOMesh *>(lMesh->GetUserDataPtr());
if (lMeshCache)
{
lMeshCache->BeginDraw(pShadingMode);
const int lSubMeshCount = lMeshCache->GetSubMeshCount();
for (int lIndex = 0; lIndex < lSubMeshCount; ++lIndex)
{
if (pShadingMode == SHADING_MODE_SHADED)
{
const KFbxSurfaceMaterial * lMaterial = pNode->GetMaterial(lIndex);
if (lMaterial)
{
const MaterialCache * lMaterialCache = static_cast<const MaterialCache *>(lMaterial->GetUserDataPtr());
if (lMaterialCache)
{
lMaterialCache->SetCurrentMaterial();
}
}
else
{
// Draw green for faces without material
MaterialCache::SetDefaultMaterial();
}
}
lMeshCache->Draw(lIndex, pShadingMode);
}
lMeshCache->EndDraw(pShadingMode);
}
else
{
// OpenGL driver is too lower and use Immediate Mode
glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
const int lPolygonCount = lMesh->GetPolygonCount();
for (int lPolygonIndex = 0; lPolygonIndex < lPolygonCount; lPolygonIndex++)
{
const int lVerticeCount = lMesh->GetPolygonSize(lPolygonIndex);
glBegin(GL_LINE_LOOP);
for (int lVerticeIndex = 0; lVerticeIndex < lVerticeCount; lVerticeIndex++)
{
glVertex3dv((GLdouble *)lVertexArray);
}
glEnd();
}
}
I am not the author of this sample, but I believe sometimes different mesh types, such as nurbs curves and the likes, are not converted to a VBO. But I am not sure of that. Perhaps you can go and check the part where it decides create the VBO based on the Node Attribute type, that might tell you. Of course, I agree with you, everything should be drawn using VBO, otherwise its a huge performance hit.
Can't find what you're looking for? Ask the community or share your knowledge.