public EngineRoot() : base(640, 480, new GraphicsMode(), "OpenGL Example", 0, DisplayDevice.Default, 4, 0, GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug) { //Enable Debugger EnableConsoleDebug(); currentCamera = new QuatCamera(640/480); }
protected override void OnLoad(System.EventArgs e) { sbyte a = -100; Console.WriteLine(a); Console.WriteLine((byte)a); VSync = VSyncMode.On; float aspectRatio = ClientSize.Width / (float)(ClientSize.Height); currentCamera = new QuatCamera(aspectRatio); shader = new Shader(); shader.CreateShader(); Matrix4 proj = currentCamera.getProjectionMatrix(); shader.setUniformMatrix4("projection_matrix", ref proj); Matrix4 view = currentCamera.getViewMatrix(); shader.setUniformMatrix4("view_matrix", ref view); meshes = new Mesh[1]; for (int i = 0; i < meshes.Length; i++) { //meshes[i] = MeshBuilder.create(scalar, (i*5)+1,true); meshes[i] = new Mesh(); List<Vector3f> vert; List<int> ind; SurfaceExtractor.extract(scalar,out vert,out ind, (i * 5) + 1, false); Vector3[] vertA = V2V(vert.ToArray()); Vector3[] normA = Mesh.calcNormals(vertA,ind).ToArray(); meshes[i].Create(vertA,normA,ind.ToArray()); } GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); // Other state GL.Enable(EnableCap.DepthTest); GL.ClearColor(System.Drawing.Color.MidnightBlue); shader.Use(); }