Fix rendering artifacts with novbo=true gentangents=true
glDrawRangeElements needs to know the range of vertexs that are used by the index array. With VBOs it doesn't really matter if the range is wrong (all the vertexes are in GPU memory anyway), but with CPU vertex arrays the driver has to memcpy the given range of data, so incorrect bounds will result in garbage data being rendered. With gentangents, the rendered mesh can have more vertexes than the original CModelDef, but was rendered with the CModelDef's vertex count. Use the correct vertex count instead. Refs #2050. This was SVN commit r13734.
This commit is contained in:
parent
9c4801e107
commit
deb64d36fc
@ -379,7 +379,7 @@ void InstancingModelRenderer::RenderModel(const CShaderProgramPtr& shader, int U
|
||||
#if CONFIG2_GLES
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
|
||||
#else
|
||||
pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices()-1,
|
||||
pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)m->imodeldef->m_Array.GetNumVertices()-1,
|
||||
(GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldefIndexBase);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user