Fix T40231: Crash with matcaps

This commit is contained in:
Campbell Barton 2014-05-17 14:48:10 +10:00
parent 5ed449dabb
commit 575d3dd5ba
Notes: blender-bot 2023-02-14 10:37:51 +01:00
Referenced by issue #40231, Enabling MatCap shading quits Blender in specific case
1 changed files with 8 additions and 3 deletions

View File

@ -575,11 +575,16 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
new_glmode = mface->v4 ? GL_QUADS : GL_TRIANGLES;
new_matnr = mface->mat_nr + 1;
new_shademodel = (lnors || (mface->flag & ME_SMOOTH)) ? GL_SMOOTH : GL_FLAT;
if (new_glmode != glmode || new_matnr != matnr || new_shademodel != shademodel) {
if ((new_glmode != glmode) || (new_shademodel != shademodel) ||
(setMaterial && (new_matnr != matnr)))
{
glEnd();
drawCurrentMat = setMaterial(matnr = new_matnr, NULL);
if (setMaterial) {
drawCurrentMat = setMaterial(matnr = new_matnr, NULL);
}
glShadeModel(shademodel = new_shademodel);
glBegin(glmode = new_glmode);