コード例 #1
0
        public void DrawImmidiateModeVertex(Vector position, Color color, Point uvs)
        {
            GL.Color4(color.Red, color.Green, color.Blue, color.Alpha);
            GL.TexCoord2(uvs.X, uvs.Y);
            //GL.Color4(System.Drawing.Color.Aquamarine);
            GL.Vertex3(position.X, position.Y, position.Z);

            ////Veiw port size;
            //double height = 200;
            //double width = 200;
            //double halfHeight = height / 2;
            //double halfWidth = height / 2;

            ////Sprite location
            //double x = 450;
            //double y = 450;
            //double z = 0;

            //float topUV = 0;
            //float bottomUV = 1;
            //float leftUV = 0;
            //float rightUV = 1;
            //GL.TexCoord2(leftUV, topUV);
            //GL.Vertex3(x - halfHeight, y + halfHeight, z); // top left
            //GL.TexCoord2(rightUV, topUV);
            //GL.Vertex3(x + halfWidth, y + halfHeight, z); // top right
            //GL.TexCoord2(leftUV, bottomUV);
            //GL.Vertex3(x - halfWidth, y - halfHeight, z); // bottom left

            //GL.TexCoord2(rightUV, topUV);
            //GL.Vertex3(x + halfWidth, y + halfHeight, z); // top right
            //GL.TexCoord2(rightUV, bottomUV);
            //GL.Vertex3(x + halfWidth, y - halfHeight, z); // bottom right
            //GL.TexCoord2(leftUV, bottomUV);
            //GL.Vertex3(x - halfWidth, y - halfHeight, z); // bottom left
        }
コード例 #2
0
 public void DrawImmidiateModeVertex(Vector position, Color color, Point uvs)
 {
     GL.Color4(color.Red, color.Green, color.Blue, color.Alpha);
     GL.TexCoord2(uvs.X, uvs.Y);
     GL.Vertex3(position.X, position.Y, position.Z);
 }
コード例 #3
0
ファイル: Sprite.cs プロジェクト: bitstrem/game_engine_csharp
        private void InitVertexPositions(Vector position, double width, double height)
        {
            double halfWidth = width / 2;
            double halfHeight = height / 2;
            //Clockwise creation of two triangles to make a quad.

            //TopLeft, TopRight, BottomLeft
            _vertexPositions[0] = new Vector(position.X - halfWidth, position.Y +
                halfHeight, position.Z);
            _vertexPositions[1] = new Vector(position.X + halfWidth, position.Y +
                halfHeight, position.Z);
            _vertexPositions[2] = new Vector(position.X - halfWidth, position.Y -
                halfHeight, position.Z);

            //TopRight, BottomRight, BottomLeft
            _vertexPositions[3] = new Vector(position.X + halfWidth, position.Y +
                halfHeight, position.Z);
            _vertexPositions[4] = new Vector(position.X + halfWidth, position.Y -
                halfHeight, position.Z);
            _vertexPositions[5] = new Vector(position.X - halfWidth, position.Y -
                halfHeight, position.Z);
        }
コード例 #4
0
ファイル: Sprite.cs プロジェクト: bitstrem/game_engine_csharp
 public void SetPosition(Vector position)
 {
     InitVertexPositions(position, GetWidth(), GetHeight());
 }