private void glView1_PaintCanvas(object sender, CanvasEventArgs e) { GLGraphics g = new GLGraphics(e); Draw(g); }
private void Draw3dStuff(GLGraphics g, Rectangle rc) { var gl = g.Canvas; gl.BeginPerspective(rc, 45.0, 0.2, 1000.0); //gl.BeginOrtho(rc, -100, 100, -100, 100, -100, 100); gl.SetCamera(camera); Draw3dGrid(gl, 100, 20); List<GLPoint> vertices = new List<GLPoint>(); float s = 10.0f; vertices.Add(new GLPoint(s, s, -s, Color.Red)); vertices.Add(new GLPoint(-s, s, -s, Color.Green)); vertices.Add(new GLPoint(-s, s, s, Color.Blue)); vertices.Add(new GLPoint(s, s, s, Color.Cyan)); vertices.Add(new GLPoint(s, -s, s, Color.Green)); vertices.Add(new GLPoint(-s, -s, s, Color.Green)); vertices.Add(new GLPoint(-s, -s, -s, Color.Green)); vertices.Add(new GLPoint(s, -s, -s, Color.Green)); vertices.Add(new GLPoint(s, s, s, Color.Blue)); vertices.Add(new GLPoint(-s, s, s, Color.Blue)); vertices.Add(new GLPoint(-s, -s, s, Color.Blue)); vertices.Add(new GLPoint(s, -s, s, Color.Blue)); vertices.Add(new GLPoint(s, -s, -s, Color.Cyan)); vertices.Add(new GLPoint(-s, -s, -s, Color.Cyan)); vertices.Add(new GLPoint(-s, s, -s, Color.Cyan)); vertices.Add(new GLPoint(s, s, -s, Color.Cyan)); vertices.Add(new GLPoint(-s, s, s, Color.Magenta)); vertices.Add(new GLPoint(-s, s, -s, Color.Magenta)); vertices.Add(new GLPoint(-s, -s, -s, Color.Magenta)); vertices.Add(new GLPoint(-s, -s, s, Color.Magenta)); vertices.Add(new GLPoint(s, s, -s, Color.Yellow)); vertices.Add(new GLPoint(s, s, s, Color.Yellow)); vertices.Add(new GLPoint(s, -s, s, Color.Yellow)); vertices.Add(new GLPoint(s, -s, -s, Color.Yellow)); gl.DrawQuads(vertices.ToArray(), false); gl.EndPerspectiveOrOrtho(); }