TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.1k stars 222 forks source link

OpenGL Error 1281 (Invalid value) Fix #32

Closed Maxchii closed 3 years ago

Maxchii commented 9 years ago

Hi,

In void BatchRenderer2D::flush() at line 247 you are calling glDrawElements(GL_TRIANGLES, m_IndexCount, GL_UNSIGNED_INT, NULL); however the m_IndexCount is never initialized, and so it causes glGetError() to report a 1281 Invalid value in the first iteration. To fix this you simply initialize the value to zero in the constructor.

Hope this helps.