Beispiel #1
0
        private void CreateDisplayList(OpenGL gl)
        {
            displayList = new DisplayList();

            displayList.Generate(gl);
            displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);

            //Push all attributes, disable lighting and depth testing.
            gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
                OpenGL.GL_LINE_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.Disable(OpenGL.GL_LIGHTING);
            gl.Disable(OpenGL.GL_TEXTURE_2D);
            gl.DepthFunc(OpenGL.GL_ALWAYS);

            //Set line width.
            gl.LineWidth(lineWidth);

            //Draw the line.
            gl.Begin(OpenGL.GL_LINES);
            gl.Color(Convert.ColorToGLColor(c1));
            gl.Vertex(v1.X, v1.Y, v1.Z);
            gl.Color(Convert.ColorToGLColor(c2));
            gl.Vertex(v2.X, v2.Y, v2.Z);
            gl.End();

            //  Restore attributes.
            gl.PopAttrib();

            displayList.End(gl);
        }
Beispiel #2
0
 public static bool IsList(OpenGL gl, DisplayList displayList)
 {
     //	Is the specified list a proper display list?
     if(gl.IsList(displayList.list) == OpenGL.TRUE)
         return true;
     else
         return false;
 }
Beispiel #3
0
 public static bool IsList(OpenGL gl, DisplayList displayList)
 {
     //	Is the specified list a proper display list?
     if (gl.IsList(displayList.list) == OpenGL.TRUE)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #4
0
        private void CreateDisplayList(OpenGL gl)
        {
            displayList = new DisplayList();

            displayList.Generate(gl);
            displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);

            //Push all attributes, disable lighting and depth testing.
            gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
                OpenGL.GL_LINE_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.Disable(OpenGL.GL_LIGHTING);
            gl.Disable(OpenGL.GL_TEXTURE_2D);
            gl.DepthFunc(OpenGL.GL_ALWAYS);

            //Set line width.
            gl.LineWidth(lineWidth);

            //Draw the line.
            gl.Begin(OpenGL.GL_LINES);
            for (float i = (size * -1); i < size; i+=0.4f)
            {
                float add = 0.2f;
                if (i > 0) add = 0.4f;
                if (i < 0 && i > -0.2f) add = 0.4f;
                gl.Color(1f, 0f, 0f, 1f);
                gl.Vertex(i, 0, 0);
                gl.Vertex(i + add, 0, 0);
                gl.Color(0f, 1f, 0f, 1f);
                gl.Vertex(0, i, 0);
                gl.Vertex(0, i + add, 0);
                gl.Color(0f, 0f, 1f, 1f);
                gl.Vertex(0, 0, i);
                gl.Vertex(0, 0, i + add);
            }
            gl.End();

            //  Restore attributes.
            gl.PopAttrib();

            displayList.End(gl);
        }
Beispiel #5
0
        private void CreateDisplayList(OpenGL gl)
        {
            displayList = new DisplayList();

            displayList.Generate(gl);
            displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);

            //Push all attributes, disable lighting and depth testing.
            gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
                OpenGL.GL_LINE_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.Disable(OpenGL.GL_LIGHTING);
            gl.Disable(OpenGL.GL_TEXTURE_2D);
            gl.DepthFunc(OpenGL.GL_ALWAYS);

            //Set line width.
            gl.LineWidth(lineWidth);

            //Draw the line.
            gl.Begin(OpenGL.GL_LINES);
            for (int i = (size * -1); i <= size; i++)
            {
                if (i != 0)
                {
                    if ((i % 4) == 0)
                        gl.Color(Convert.ColorToGLColor(darkColor));
                    else
                        gl.Color(Convert.ColorToGLColor(lightColor));
                    gl.Vertex(i, (size * -1), 0);
                    gl.Vertex(i, size, 0);
                    gl.Vertex((size * -1), i, 0);
                    gl.Vertex(size, i, 0);
                }
            }
            gl.End();

            //  Restore attributes.
            gl.PopAttrib();

            displayList.End(gl);
        }
Beispiel #6
0
        private void CreateDisplayList(OpenGL gl)
        {
            displayList = new DisplayList();

            displayList.Generate(gl);
            displayList.New(gl, DisplayList.DisplayListMode.CompileAndExecute);

            //Create sphere quadric
            IntPtr quadric = gl.NewQuadric();
            gl.QuadricNormals(quadric, OpenGL.GLU_SMOOTH);

            //Render the sphere
            gl.Sphere(quadric, r, subdivs, subdivs);

            //Delete the sphere
            gl.DeleteQuadric(quadric);

            displayList.End(gl);
        }