Example #1
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);
        }
Example #2
0
        private static GLDisplayList CreateCircle(GLContext ctx)
        {
            GLDisplayList list = new GLDisplayList(ctx);

            list.Begin();

            ctx.glBegin(GLPrimitiveType.TriangleFan);

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

            float angle = 0.0f;

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

            ctx.glEnd();

            list.End();
            return(list);
        }
Example #3
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);
        }