private static void OnDisplay() { MainLoop.MainTimer += 1000 / 60; Viewport(0, 0, MainLoop.MonitorWidth, MainLoop.MonitorHeight); Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); if (MainLoop.GameObjectsArray.Count > 0) { CheckObjectTimers(); CheckPlayerInput(); int arrCount = MainLoop.GameObjectsArray.Count; GameObject obj; int j = 0; while (true && MainLoop.GameObjectsArray.Count != 0) { obj = MainLoop.GameObjectsArray[j]; MainLogic.CheckInnerModels(obj); if (!obj.IsDead()) { UseProgram(obj.Graphic.Program); Matrix4 value = Matrix4.CreateTranslation(new Vector3(-(float)obj.Entity.AverageX, -(float)obj.Entity.AverageY, 0)) * //radius translation Matrix4.CreateRotationZ(-(float)obj.Entity.RenderAngle) * Matrix4.CreateTranslation(new Vector3((float)(obj.Entity.XCoordinate), (float)(obj.Entity.YCoordinate), 0)); obj.Graphic.Program["model_matrix"].SetValue(value); BindBufferToShaderAttribute(obj.Graphic.Data._shaderVertices, obj.Graphic.Program, "vertexPosition"); if (obj.Graphic is TexturedGraphicModule) { BindTexture(TextureTarget.Texture2D, ((TexturedGraphicModule)obj.Graphic).Texture.TextureID); BindBufferToShaderAttribute(obj.Graphic.Data._shaderTextureUV, obj.Graphic.Program, "vertexUV"); } else { BindTexture(TextureTarget.Texture2D, 0); BindBufferToShaderAttribute(obj.Graphic.Data._shaderColors, obj.Graphic.Program, "vertexColor"); } BindBuffer(obj.Graphic.Data._shaderDrawQueue); DrawElements(BeginMode.TriangleFan, obj.Graphic.Data._shaderDrawQueue.Count, DrawElementsType.UnsignedInt, IntPtr.Zero); } j++; if (arrCount == j) { break; } } } MainLogic.ClearGarbage(MainLoop.GameObjectsArray); glutSwapBuffers(); }