private void LoadLevel() { level = new ObjModel("nav_test.obj"); var levelTris = level.GetTriangles(); var levelNorms = level.GetNormals(); levelNumVerts = levelTris.Length * 3 * 3; levelHasNorm = levelNorms != null && levelNorms.Length > 0; var bounds = TriangleEnumerable.FromTriangle(levelTris, 0, levelTris.Length).GetBoundingBox(); cam.Position = new Vector3(bounds.Max.X, bounds.Max.Y, bounds.Max.Z) * 1.5f; cam.RotateHeadingTo(-25); cam.RotatePitchTo(315); //TODO fix camera, it breaks with lookat... //cam.LookAt(new Vector3(bounds.Center.X, bounds.Center.Y, bounds.Center.Z)); levelVbo = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, levelVbo); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(levelNumVerts * 4), levelTris, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); if (levelHasNorm) { levelNormVbo = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, levelNormVbo); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(levelNorms.Length * 3 * 4), levelNorms, BufferUsageHint.StaticDraw); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); } }