Random glDrawElements Error

BlitzMax Forums/MiniB3D Module/Random glDrawElements Error

FreetimeCoder(Posted 2009) [#1]
Hi,

I have a weird problem. When loading meshes I get an Memory Access Violation Error pointing to glDrawElements.
When setting TGlobal.vbo_enabled = False I can decrease the occourance of these errors, but still I get them every once in a while. Now the strange part: They occour totally random. I am running my Code like 4 times and on the fifth the error occurs. Then I can run it smooth for another 2 times and on the third it crashes.

Always pointing at:

If vbo
	glDrawElements(GL_TRIANGLES,surf.no_tris*3,GL_UNSIGNED_SHORT,Null)
Else
	glDrawElements(GL_TRIANGLES,surf.no_tris*3,GL_UNSIGNED_SHORT,surf.tris)
EndIf


I have absolutley no idea whats wrong. As for sample code I can say: A simple LoadMesh(anymesh) can trigger it.

greetings