示例#1
0
        protected override void DrawLine(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder frumstumShape = new SharpGL.SceneGraph.Quadrics.Cylinder();
            frumstumShape.TopRadius        = SizeY;
            frumstumShape.BaseRadius       = SizeX;
            frumstumShape.Height           = SizeZ;
            frumstumShape.Slices           = Slices;
            frumstumShape.Stacks           = Stacks;
            frumstumShape.QuadricDrawStyle = DrawStyle.Line;

            frumstumShape.CreateInContext(gl);
            frumstumShape.PushObjectSpace(gl);
            frumstumShape.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            frumstumShape.PopObjectSpace(gl);
            frumstumShape.DestroyInContext(gl);
        }
示例#2
0
文件: Pyramid.cs 项目: n1hs/OpenGL_UI
        protected override void DrawLine(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder pyramid = new SharpGL.SceneGraph.Quadrics.Cylinder();
            pyramid.TopRadius        = SizeY;
            pyramid.BaseRadius       = SizeX;
            pyramid.Height           = SizeZ;
            pyramid.Slices           = Slices;
            pyramid.Stacks           = Stacks;
            pyramid.QuadricDrawStyle = DrawStyle.Line;

            pyramid.CreateInContext(gl);
            pyramid.PushObjectSpace(gl);
            pyramid.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            pyramid.PopObjectSpace(gl);
            pyramid.DestroyInContext(gl);
        }
示例#3
0
        protected override void DrawPoint(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder();
            cylinder.TopRadius        = SizeY;
            cylinder.BaseRadius       = SizeX;
            cylinder.Height           = SizeZ;
            cylinder.Slices           = Slices;
            cylinder.Stacks           = Stacks;
            cylinder.QuadricDrawStyle = DrawStyle.Point;

            cylinder.CreateInContext(gl);
            cylinder.PushObjectSpace(gl);
            cylinder.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            cylinder.PopObjectSpace(gl);
            cylinder.DestroyInContext(gl);
        }
示例#4
0
文件: Pyramid.cs 项目: n1hs/OpenGL_UI
        protected override void DrawPoint(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder pyramid = new SharpGL.SceneGraph.Quadrics.Cylinder();
            pyramid.TopRadius        = SizeY;
            pyramid.BaseRadius       = SizeX;
            pyramid.Height           = SizeZ;
            pyramid.Slices           = Slices;
            pyramid.Stacks           = Stacks;
            pyramid.QuadricDrawStyle = DrawStyle.Point;

            pyramid.CreateInContext(gl);
            pyramid.PushObjectSpace(gl);
            pyramid.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            pyramid.PopObjectSpace(gl);
            pyramid.DestroyInContext(gl);

            //ve base radius by point
            gl.PushMatrix();
            gl.Rotate(45, 0, 0, 1);
            gl.Begin(OpenGL.GL_POINTS);
            double stacks = Stacks;
            double tempX  = SizeX * (System.Math.Sqrt(2)) / 2;
            double tempy  = SizeY;

            for (double j = 0; j <= SizeZ; j += SizeZ / Stacks)
            {
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(i, -tempX, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(i, tempX, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(-tempX, i, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(tempX, i, j);
                }
                tempX -= ((SizeX - SizeY) / Stacks) * Math.Sqrt(2) / 2;
            }
            gl.End();
            gl.PopMatrix();
        }