Пример #1
0
        public ChessFigures(OpenGL gl, Point3D position, float boardSize, ColorF colorWhite, ColorF colorBlack, Texture textureWhite = null,
                            Texture textureBlack = null)
            : base(position)
        {
            this.boardSize    = boardSize;
            this.colorWhite   = colorWhite;
            this.colorBlack   = colorBlack;
            this.textureWhite = textureWhite;
            this.textureBlack = textureBlack;

            //Bishop = new FigureFromOBJSharpGL(gl, new Point3D(),
            //    @"ModelOBJ\Bishop.obj", scale);
            King = new FigureFromOBJSharpGL(gl, new Point3D(),
                                            @"ModelOBJ\King.obj", scale, 100);
            //Knight = new FigureFromOBJSharpGL(gl, new Point3D(),
            //    @"ModelOBJ\Knight.obj", scale);
            //Pawn = new FigureFromOBJSharpGL(gl, new Point3D(),
            //    @"ModelOBJ\Pawn.obj", scale);
            //Queen = new FigureFromOBJSharpGL(gl, new Point3D(),
            //    @"ModelOBJ\Queen.obj", scale);
            //Rook = new FigureFromOBJSharpGL(gl, new Point3D(),
            //    @"ModelOBJ\Rook.obj", scale);

            ListInd = gl.GenLists(1);
            gl.NewList(ListInd, OpenGL.GL_COMPILE);
            {
                gl.Translate(position.x, position.y, position.z);
                DrawFigures(gl, boardSize, colorWhite, colorBlack, textureWhite, textureBlack);
            }
            gl.EndList();
        }
Пример #2
0
 private void DrawFigureInPosition(OpenGL gl, FigureFromOBJSharpGL figure, char x, int y)
 {
     gl.PushMatrix();
     DoTranslateToPosition(gl, x, y);
     gl.Rotate(90, 0, 1, 0);
     figure.Draw(gl);
     gl.PopMatrix();
 }