Exemplo n.º 1
0
        public static GLDisplayList CreateSphere()
        {
            GLDisplayList dl = new GLDisplayList();

            dl.Begin();
            DrawSphere(new Vector3(), 1.0f, 40);
            dl.End();

            return(dl);
        }
Exemplo n.º 2
0
        private static GLDisplayList CreateLine()
        {
            GLDisplayList list = new GLDisplayList();

            GL.Begin(BeginMode.Lines);

            GL.Vertex3(0.0f, 0.0f, 0.0f);
            GL.Vertex3(2.0f, 0.0f, 0.0f);

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 3
0
        private static GLDisplayList CreateLine(GLContext ctx)
        {
            GLDisplayList list = new GLDisplayList(ctx);

            ctx.glBegin(GLPrimitiveType.Lines);

            ctx.glVertex(0.0f, 0.0f, 0.0f);
            ctx.glVertex(2.0f, 0.0f, 0.0f);

            ctx.glEnd();

            list.End();
            return(list);
        }
Exemplo n.º 4
0
        private static GLDisplayList CreateSphere(GLContext ctx)
        {
            int quad = ctx.gluNewQuadric();

            ctx.gluQuadricDrawStyle(quad, GLUQuadricDrawStyle.GLU_FILL);
            ctx.gluQuadricOrientation(quad, GLUQuadricOrientation.Outside);

            GLDisplayList dl = new GLDisplayList(ctx);

            dl.Begin();
            ctx.gluSphere(quad, 1.0f, 40, 40);
            dl.End();

            ctx.gluDeleteQuadric(quad);

            return(dl);
        }
Exemplo n.º 5
0
        public static GLDisplayList CreateSphere(TKContext ctx)
        {
            //IntPtr quad = Glu.NewQuadric();
            //Glu.QuadricDrawStyle(quad, QuadricDrawStyle.Fill);
            //Glu.QuadricOrientation(quad, QuadricOrientation.Outside);

            GLDisplayList dl = new GLDisplayList();

            dl.Begin();

            DrawSphere(new Vector3(), 1.0f, 40);
            //Glu.Sphere(quad, 1.0f, 40, 40);
            dl.End();

            //Glu.DeleteQuadric(quad);

            return(dl);
        }
Exemplo n.º 6
0
        private static GLDisplayList CreateSquare()
        {
            GLDisplayList list = new GLDisplayList();

            list.Begin();

            GL.Begin(BeginMode.LineLoop);

            GL.Vertex2(0.0f, 0.0f);
            GL.Vertex2(0.0f, 1.0f);
            GL.Vertex2(1.0f, 1.0f);
            GL.Vertex2(1.0f, 0.0f);
            GL.Vertex2(0.0f, 0.0f);

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 7
0
        private static GLDisplayList CreateRing()
        {
            GLDisplayList list = new GLDisplayList();

            list.Begin();

            GL.Begin(BeginMode.LineLoop);

            float angle = 0.0f;

            for (int i = 0; i < 360; i++, angle = i * Maths._deg2radf)
            {
                GL.Vertex2(Math.Cos(angle), Math.Sin(angle));
            }

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 8
0
        private static GLDisplayList CreateRing(GLContext ctx)
        {
            GLDisplayList list = new GLDisplayList(ctx);

            list.Begin();

            ctx.glBegin(GLPrimitiveType.LineLoop);

            float angle = 0.0f;

            for (int i = 0; i < 360; i++, angle = i * Maths._deg2radf)
            {
                ctx.glVertex(Math.Cos(angle), Math.Sin(angle));
            }

            ctx.glEnd();

            list.End();
            return(list);
        }
Exemplo n.º 9
0
        private static GLDisplayList CreateCube()
        {
            GLDisplayList list = new GLDisplayList();

            list.Begin();

            GL.Begin(BeginMode.QuadStrip);

            Vector3 p1 = new Vector3(0);
            Vector3 p2 = new Vector3(0.99f);

            GL.Vertex3(p1._x, p1._y, p1._z);
            GL.Vertex3(p1._x, p2._y, p1._z);
            GL.Vertex3(p2._x, p1._y, p1._z);
            GL.Vertex3(p2._x, p2._y, p1._z);
            GL.Vertex3(p2._x, p1._y, p2._z);
            GL.Vertex3(p2._x, p2._y, p2._z);
            GL.Vertex3(p1._x, p1._y, p2._z);
            GL.Vertex3(p1._x, p2._y, p2._z);
            GL.Vertex3(p1._x, p1._y, p1._z);
            GL.Vertex3(p1._x, p2._y, p1._z);

            GL.End();

            GL.Begin(BeginMode.Quads);

            GL.Vertex3(p1._x, p2._y, p1._z);
            GL.Vertex3(p1._x, p2._y, p2._z);
            GL.Vertex3(p2._x, p2._y, p2._z);
            GL.Vertex3(p2._x, p2._y, p1._z);

            GL.Vertex3(p1._x, p1._y, p1._z);
            GL.Vertex3(p1._x, p1._y, p2._z);
            GL.Vertex3(p2._x, p1._y, p2._z);
            GL.Vertex3(p2._x, p1._y, p1._z);

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 10
0
        private static GLDisplayList CreateCube(GLContext ctx)
        {
            GLDisplayList list = new GLDisplayList(ctx);

            list.Begin();

            ctx.glBegin(GLPrimitiveType.QuadStrip);

            Vector3 p1 = new Vector3(0);
            Vector3 p2 = new Vector3(0.99f);

            ctx.glVertex(p1._x, p1._y, p1._z);
            ctx.glVertex(p1._x, p2._y, p1._z);
            ctx.glVertex(p2._x, p1._y, p1._z);
            ctx.glVertex(p2._x, p2._y, p1._z);
            ctx.glVertex(p2._x, p1._y, p2._z);
            ctx.glVertex(p2._x, p2._y, p2._z);
            ctx.glVertex(p1._x, p1._y, p2._z);
            ctx.glVertex(p1._x, p2._y, p2._z);
            ctx.glVertex(p1._x, p1._y, p1._z);
            ctx.glVertex(p1._x, p2._y, p1._z);

            ctx.glEnd();

            ctx.glBegin(GLPrimitiveType.Quads);

            ctx.glVertex(p1._x, p2._y, p1._z);
            ctx.glVertex(p1._x, p2._y, p2._z);
            ctx.glVertex(p2._x, p2._y, p2._z);
            ctx.glVertex(p2._x, p2._y, p1._z);

            ctx.glVertex(p1._x, p1._y, p1._z);
            ctx.glVertex(p1._x, p1._y, p2._z);
            ctx.glVertex(p2._x, p1._y, p2._z);
            ctx.glVertex(p2._x, p1._y, p1._z);

            ctx.glEnd();

            list.End();
            return(list);
        }
Exemplo n.º 11
0
        private static GLDisplayList CreateAxes()
        {
            GLDisplayList list = new GLDisplayList();

            list.Begin();

            GL.Begin(BeginMode.Lines);

            GL.Color4(1.0f, 0.0f, 0.0f, 1.0f);

            GL.Vertex3(0.0f, 0.0f, 0.0f);
            GL.Vertex3(2.0f, 0.0f, 0.0f);
            GL.Vertex3(1.0f, 0.0f, 0.0f);
            GL.Vertex3(1.0f, 1.0f, 0.0f);
            GL.Vertex3(1.0f, 0.0f, 0.0f);
            GL.Vertex3(1.0f, 0.0f, 1.0f);

            GL.Color4(0.0f, 1.0f, 0.0f, 1.0f);

            GL.Vertex3(0.0f, 0.0f, 0.0f);
            GL.Vertex3(0.0f, 2.0f, 0.0f);
            GL.Vertex3(0.0f, 1.0f, 0.0f);
            GL.Vertex3(1.0f, 1.0f, 0.0f);
            GL.Vertex3(0.0f, 1.0f, 0.0f);
            GL.Vertex3(0.0f, 1.0f, 1.0f);

            GL.Color4(0.0f, 0.0f, 1.0f, 1.0f);

            GL.Vertex3(0.0f, 0.0f, 0.0f);
            GL.Vertex3(0.0f, 0.0f, 2.0f);
            GL.Vertex3(0.0f, 0.0f, 1.0f);
            GL.Vertex3(1.0f, 0.0f, 1.0f);
            GL.Vertex3(0.0f, 0.0f, 1.0f);
            GL.Vertex3(0.0f, 1.0f, 1.0f);

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 12
0
        private static GLDisplayList CreateCircle()
        {
            GLDisplayList list = new GLDisplayList();

            list.Begin();

            GL.Begin(BeginMode.TriangleFan);

            GL.Vertex3(0.0f, 0.0f, 0.0f);

            float angle = 0.0f;

            for (int i = 0; i < 361; i++, angle = i * Maths._deg2radf)
            {
                GL.Vertex2(Math.Cos(angle), Math.Sin(angle));
            }

            GL.End();

            list.End();
            return(list);
        }
Exemplo n.º 13
0
 /*
  * [DllImport("opengl32.dll")]
  * internal abstract ?? glDebugEntry(??);
  * */
 public void glDeleteList(GLDisplayList list)
 {
     glDeleteLists(list._id, 1); list._id = 0;
 }
Exemplo n.º 14
0
 internal void glCallList(GLDisplayList list)
 {
     glCallList(list._id);
 }