コード例 #1
0
ファイル: Shapes.cs プロジェクト: Xenfar/Sharp3D
        public override void Draw()
        {
            //QFace[] cube = new QFace[6];
            //use first one for primitive plane
            gl.Begin(OpenGL.GL_QUADS);
            //gl.Color(c.rgb);
            Setmaterial((float)c.R, (float)c.B, (float)c.G, gl);
            cube[0] = new QFace(gl, verticies[0] * size, verticies[1] * size, verticies[2] * size, verticies[3] * size);//top


            cube[1] = new QFace(gl, verticies[4] * size, verticies[5] * size, verticies[6] * size, verticies[7] * size);//bottom

            cube[2] = new QFace(gl, verticies[3] * size, verticies[2] * size, verticies[5] * size, verticies[4] * size);

            cube[3] = new QFace(gl, verticies[7] * size, verticies[6] * size, verticies[1] * size, verticies[0] * size);

            cube[4] = new QFace(gl, verticies[2] * size, verticies[1] * size, verticies[6] * size, verticies[5] * size);

            cube[5] = new QFace(gl, verticies[0] * size, verticies[3] * size, verticies[4] * size, verticies[7] * size);
            for (int i = 0; i < cube.Length; i++)
            {
                cube[i].Int();
            }
            //base.Draw();
            gl.End();
        }
コード例 #2
0
ファイル: Shapes.cs プロジェクト: Xenfar/Sharp3D
        public override void DrawWire()
        {
            //  InitiateVerticies(out Vertex[] outed);

            templSize = size + 0.005f;
            gl.Disable(OpenGL.GL_LIGHTING);
            gl.Begin(OpenGL.GL_LINE_LOOP);
            gl.Color(wire.rgb);

            cube[0] = new QFace(gl, verticies[0] * templSize, verticies[1] * templSize, verticies[2] * templSize, verticies[3] * templSize); //top

            cube[1] = new QFace(gl, verticies[4] * templSize, verticies[5] * templSize, verticies[6] * templSize, verticies[7] * templSize); //bottom

            cube[2] = new QFace(gl, verticies[3] * templSize, verticies[2] * templSize, verticies[5] * templSize, verticies[4] * templSize);

            cube[3] = new QFace(gl, verticies[7] * templSize, verticies[6] * templSize, verticies[1] * templSize, verticies[0] * templSize);

            cube[4] = new QFace(gl, verticies[2] * templSize, verticies[1] * templSize, verticies[6] * templSize, verticies[5] * templSize);

            cube[5] = new QFace(gl, verticies[0] * templSize, verticies[3] * templSize, verticies[4] * templSize, verticies[7] * templSize);
            for (int i = 0; i < cube.Length; i++)
            {
                cube[i].Int();
            }
            gl.End();

            gl.Begin(OpenGL.GL_POINTS);
            gl.Color(points.rgb);
            temppSize = size + 0.009f;
            cube[0]   = new QFace(gl, verticies[0] * temppSize, verticies[1] * temppSize, verticies[2] * temppSize, verticies[3] * temppSize); //top

            cube[1] = new QFace(gl, verticies[4] * temppSize, verticies[5] * temppSize, verticies[6] * temppSize, verticies[7] * temppSize);   //bottom

            cube[2] = new QFace(gl, verticies[3] * temppSize, verticies[2] * temppSize, verticies[5] * temppSize, verticies[4] * temppSize);

            cube[3] = new QFace(gl, verticies[7] * temppSize, verticies[6] * temppSize, verticies[1] * temppSize, verticies[0] * temppSize);

            cube[4] = new QFace(gl, verticies[2] * temppSize, verticies[1] * temppSize, verticies[6] * temppSize, verticies[5] * temppSize);

            cube[5] = new QFace(gl, verticies[0] * temppSize, verticies[3] * temppSize, verticies[4] * temppSize, verticies[7] * temppSize);
            for (int i = 0; i < cube.Length; i++)
            {
                cube[i].Int();
            }
            gl.End();
            gl.Enable(OpenGL.GL_LIGHTING);
            //base.DrawWire();
        }