Removed redundant state changes.

This commit is contained in:
Leonardo Zide 2021-03-28 13:30:35 -07:00
parent 989373155f
commit b6acab713d

View file

@ -944,16 +944,26 @@ void lcContext::SetVertexFormatConditional(int BufferOffset)
mVertexBufferOffset = VertexBufferPointer; mVertexBufferOffset = VertexBufferPointer;
if (!mNormalEnabled)
{
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
mNormalEnabled = true; // todo: store state using an array mNormalEnabled = true; // todo: store state using an array
}
if (!mTexCoordEnabled)
{
glEnableVertexAttribArray(2);
mTexCoordEnabled = true; mTexCoordEnabled = true;
}
if (!mColorEnabled)
{
glEnableVertexAttribArray(3);
mColorEnabled = true; mColorEnabled = true;
} }
} }
} }
}
void lcContext::SetVertexFormat(int BufferOffset, int PositionSize, int NormalSize, int TexCoordSize, int ColorSize, bool EnableNormals) void lcContext::SetVertexFormat(int BufferOffset, int PositionSize, int NormalSize, int TexCoordSize, int ColorSize, bool EnableNormals)
{ {