當前位置: 首頁>>代碼示例>>C#>>正文


C# OpenGL.Vertex方法代碼示例

本文整理匯總了C#中SharpGL.OpenGL.Vertex方法的典型用法代碼示例。如果您正苦於以下問題:C# OpenGL.Vertex方法的具體用法?C# OpenGL.Vertex怎麽用?C# OpenGL.Vertex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SharpGL.OpenGL的用法示例。


在下文中一共展示了OpenGL.Vertex方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Draw3D

        public override void Draw3D(OpenGL gl)
        {
            float drawCoord = (int)(y * 2) % pieces;

            float size = 2;
            double theta = 0;
            if (fever)
            {
                size = 3f;
                if (xpos < -4)
                    theta = (xpos + 4) * Math.PI / 4;
                else if (xpos > 4)
                    theta = (xpos - 4) * Math.PI / 4;
            }

            gl.Begin(BeginMode.Quads);
            {
                if (fever)
                    gl.Color(1.0f, 0.5f, 0.5f);
                gl.TexCoord(drawCoord / pieces, 1);
                gl.Vertex(xpos * 0.5f - (0.4f * size) * Math.Cos(theta), y - (0.4f * size) * Math.Sin(theta), 0);
                gl.TexCoord(drawCoord / pieces, 0);
                gl.Vertex(xpos * 0.5f - (0.4f * size) * Math.Cos(theta), y - (0.4f * size) * Math.Sin(theta), size);
                gl.TexCoord((drawCoord + 1) / pieces, 0);
                gl.Vertex(xpos * 0.5f + (0.4f * size) * Math.Cos(theta), y + (0.4f * size) * Math.Sin(theta), size);
                gl.TexCoord((drawCoord + 1) / pieces, 1);
                gl.Vertex(xpos * 0.5f + (0.4f * size) * Math.Cos(theta), y + (0.4f * size) * Math.Sin(theta), 0);
                gl.Color(1.0f, 1.0f, 1.0f);
            }
            gl.End();
        }
開發者ID:Celicath,項目名稱:RRRR,代碼行數:31,代碼來源:Player.cs

示例2: DrawQuadsWithTexture

 private void DrawQuadsWithTexture(OpenGL gl, int texture, params int[][][] quads)
 {
     gl.BindTexture(OpenGL.GL_TEXTURE_2D, _textures[texture]);
     gl.Begin(OpenGL.GL_QUADS);
     foreach (var quad in quads)
     {
         gl.TexCoord(0.0f, 0.0f); gl.Vertex(quad[0]);
         gl.TexCoord(1.0f, 0.0f); gl.Vertex(quad[1]);
         gl.TexCoord(1.0f, 1.0f); gl.Vertex(quad[2]);
         gl.TexCoord(0.0f, 1.0f); gl.Vertex(quad[3]);
     }
     gl.End();
 }
開發者ID:fbmly007,項目名稱:3dsexplorer,代碼行數:13,代碼來源:frmAbout.cs

示例3: paint

 public void paint(OpenGL gl)
 {
     gl.Color(1f, 1f, 1f);
     gl.Begin(OpenGL.GL_TRIANGLE_STRIP);
         gl.Vertex(x, y + height, 0);
         gl.Vertex(x, y, 0);
         gl.Vertex(x+width, y + height, 0);
         gl.Vertex(x+width, y, 0);
     gl.End();
     gl.LineWidth(1);
     gl.Begin(OpenGL.GL_LINES);
     gl.Color(0, 0, 0);
         if (centerCoordinateX <= x + width && centerCoordinateX >= x)
         {
             gl.Vertex4d(centerCoordinateX, y, 0, 1);
             gl.Vertex4d(centerCoordinateX, y + height, 0, 1);
         }
         if (centerCoordinateY <= y + height && centerCoordinateY >= y)
         {
             gl.Vertex4d(x, centerCoordinateY, 0, 1);
             gl.Vertex4d(x+width, centerCoordinateY, 0, 1);
         }
     gl.End();
     for(int i = 0; i < functions.Count; i++)
     {
         drawFunction(gl, functions.ElementAt(i));
     }
 }
開發者ID:shirinkinV,項目名稱:Course_work,代碼行數:28,代碼來源:Grapics.cs

示例4: DrawGrid

        public void DrawGrid(OpenGL gl, int camX,int camY)
        {
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.LoadIdentity();

            int MapHeight = tileMap.mapHeight;
            int MapWidth = tileMap.mapWidth;

            float[] darkColor = { 0.2f, 0.2f, 0.2f };
            float[] lightColor = { 0.25f, 0.25f, 0.25f };
            for (int h = 0; h < MapHeight; h++)
            {
                if (h % 10 == 0)
                {
                    gl.LineWidth(2.0f);
                    gl.Color(lightColor);
                }
                else
                {
                    gl.LineWidth(1.0f);
                    gl.Color(darkColor);
                }
                if (h == 0)
                {
                    gl.LineWidth(4.0f);
                    gl.Color(lightColor);
                }
                gl.Begin(OpenGL.GL_LINES);							// Start Drawing Verticle Cell Borders
                gl.Vertex(0 - camX, h * tileSize - camY, 0);// Left Side Of Horizontal Line
                gl.Vertex((MapWidth * tileSize) - camX, (h * tileSize) - camY, 0);// Right Side Of Horizontal Line
                gl.End();
            }
            for (int v = 0; v < MapWidth; v++)
            {
                if (v % 10 == 0)
                {
                    gl.LineWidth(2.0f);
                    gl.Color(lightColor);
                }
                else
                {
                    gl.LineWidth(1.0f);
                    gl.Color(darkColor);
                }
                if (v == 0)
                {
                    gl.LineWidth(4.0f);
                    gl.Color(lightColor);
                }
                gl.Begin(OpenGL.GL_LINES);							// Start Drawing Verticle Cell Borders
                gl.Vertex(v * tileSize - camX, 0 - camY, 0);// Left Side Of Horizontal Line
                gl.Vertex((v * tileSize) - camX, (MapHeight * tileSize) - camY, 0);// Right Side Of Horizontal Line
                gl.End();
            }
        }
開發者ID:jesterguy,項目名稱:Modern_Tactics,代碼行數:55,代碼來源:BattleMap.cs

示例5: Bed

        private void Bed(OpenGL gl, double x, double y, double z, double width, double height)
        {
            gl.Begin(OpenGL.GL_QUADS);

            gl.Color(1f, 1f, 1f, 1f);
            gl.Vertex(x, y + height, -6.0f);
            gl.Vertex(x, y, -6.0f);
            gl.Vertex(x + width, y, -6.0f);
            gl.Vertex(x + width, y + height, -6.0f);

            gl.End();
        }
開發者ID:royb3,項目名稱:pong,代碼行數:12,代碼來源:Game.xaml.cs

示例6: DrawTrefoilVertices

 private void DrawTrefoilVertices(OpenGL gl)
 {
     //  Render each vertex.
     gl.Begin(BeginMode.Points);
     foreach(var vertex in trefoilKnot.Vertices)
         gl.Vertex(vertex);
     gl.End();
 }
開發者ID:RFExplorer,項目名稱:rfexplorer-1,代碼行數:8,代碼來源:MainWindow.xaml.cs

示例7: Draw

 public override void Draw(OpenGL gl)
 {
     PointFloat _size = GetSize();
     PointFloat[] pointData = RenderLogics.RectPoint(GetPosition(), _size, GetRotation());
     byte[] color = GetColor();
     GetTexture().UseTexure(gl);
     gl.Begin(OpenGL.GL_QUADS);
     gl.Color(color[0], color[1], color[2]);
     gl.TexCoord(0, 0);
     gl.Vertex(pointData[1].x, pointData[1].y);
     gl.TexCoord(0, 1);
     gl.Vertex(pointData[0].x, pointData[0].y);
     gl.TexCoord(1, 1);
     gl.Vertex(pointData[3].x, pointData[3].y);
     gl.TexCoord(1, 0);
     gl.Vertex(pointData[2].x, pointData[2].y);
     gl.End();
 }
開發者ID:Vinic,項目名稱:TomatoEngine,代碼行數:18,代碼來源:GroundTile.cs

示例8: Draw

 public static void Draw(OpenGL gl, IEnumerable<double[]> bolt)
 {
     gl.Begin(OpenGL.GL_LINE_STRIP);
     gl.Color(0, 1, 0);
     foreach (var point in bolt)
     {
         gl.Vertex(point);
     }
     gl.End();
 }
開發者ID:KyMaP13,項目名稱:sharpcam,代碼行數:10,代碼來源:Details.cs

示例9: RenderVertices_Immediate

 private void RenderVertices_Immediate(OpenGL gl)
 {
     gl.Color(1f, 0f, 0f);
     gl.Begin(OpenGL.GL_POINTS);
     for(uint i=0;i<vertices.Length; i++)
     {
         gl.Vertex(vertices[i]);
     }
     gl.End();
 }
開發者ID:hhool,項目名稱:sharpgl,代碼行數:10,代碼來源:MainWindow.xaml.cs

示例10: CreateDisplayList

        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);
        }
開發者ID:chances,項目名稱:Animatum,代碼行數:40,代碼來源:Grid.cs

示例11: Ball

        private void Ball(OpenGL gl)
        {
            gl.Begin(OpenGL.GL_LINE_LOOP);
            for (int i = 0; i <= 10; i++)
            {
                double angle = (2 * Math.PI * i / 10);
                double x = Math.Cos(angle) - ballX;
                double y = Math.Sin(angle) - ballY;

                gl.Vertex(x, y, ballz);
            }
            gl.End();
        }
開發者ID:royb3,項目名稱:pong,代碼行數:13,代碼來源:Game.xaml.cs

示例12: drawMaze

        private void drawMaze(OpenGL gl)
        {
            if (dataModel.MazeStructure.Origin != null)
            {
                //  Draw a coloured pyramid.
                gl.Begin(OpenGL.GL_TRIANGLES);

                gl.Color(0.0f, 1.0f, 0.0f);

                float x = dataModel.MazeStructure.Origin.Coordinates.X;
                float y = dataModel.MazeStructure.Origin.Coordinates.Y;
                float z = 1.0f;

                gl.Vertex(x, y, z);

                gl.DrawText(0, 0, 128.0f, 128.0f, 128.0f, "Arial", 12.0f, "Drawing maze");

                /*
                gl.Color(1.0f, 0.0f, 0.0f);
                gl.Vertex(0.0f, 1.0f, 0.0f);
                gl.Color(0.0f, 1.0f, 0.0f);
                gl.Vertex(-1.0f, -1.0f, 1.0f);
                gl.Color(0.0f, 0.0f, 1.0f);
                gl.Vertex(1.0f, -1.0f, 1.0f);
                gl.Color(1.0f, 0.0f, 0.0f);
                gl.Vertex(0.0f, 1.0f, 0.0f);
                gl.Color(0.0f, 0.0f, 1.0f);
                gl.Vertex(1.0f, -1.0f, 1.0f);
                gl.Color(0.0f, 1.0f, 0.0f);
                gl.Vertex(1.0f, -1.0f, -1.0f);
                gl.Color(1.0f, 0.0f, 0.0f);
                gl.Vertex(0.0f, 1.0f, 0.0f);
                gl.Color(0.0f, 1.0f, 0.0f);
                gl.Vertex(1.0f, -1.0f, -1.0f);
                gl.Color(0.0f, 0.0f, 1.0f);
                gl.Vertex(-1.0f, -1.0f, -1.0f);
                gl.Color(1.0f, 0.0f, 0.0f);
                gl.Vertex(0.0f, 1.0f, 0.0f);
                gl.Color(0.0f, 0.0f, 1.0f);
                gl.Vertex(-1.0f, -1.0f, -1.0f);
                gl.Color(0.0f, 1.0f, 0.0f);
                gl.Vertex(-1.0f, -1.0f, 1.0f);
                */
                gl.End();
            }

            if (dataModel != null)
                gl.DrawText(0, 0, 128.0f, 128.0f, 128.0f, "Arial", 12.0f, dataModel.SolverAgentList.Count.ToString());
        }
開發者ID:DeanThomas1983,項目名稱:Maze2012,代碼行數:49,代碼來源:SharpGLForm.cs

示例13: Draw

        public void Draw(OpenGL gl)
        {
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, TextureID);

            int[] amb_diff = { Colour.A, Colour.B, Colour.G, Colour.A };
            gl.Material(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_AMBIENT_AND_DIFFUSE, amb_diff);

            gl.Begin(OpenGL.GL_TRIANGLES);

            for (int i = 0; i < 3; i++)
            {
                Position point = Verts[i].Point;
                UV uv = Verts[i].UV;

                if (uv != null)
                    gl.TexCoord(uv.U, uv.V);

                gl.Vertex(point.X, point.Y, point.Z);
            }

            gl.End();
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, 0);
        }
開發者ID:Kruithne,項目名稱:W3DT,代碼行數:23,代碼來源:Face.cs

示例14: drawCoordinateAxes

        private void drawCoordinateAxes(OpenGL gl)
        {
            gl.Color(OpenGlUtility.GetOpenGlColor(Color.Red));
            gl.Begin(OpenGL.GL_LINES);
            gl.Vertex(0, 0, 0);
            gl.Vertex(100, 0, 0);
            gl.End();

            gl.Color(OpenGlUtility.GetOpenGlColor(Color.Green));
            gl.Begin(OpenGL.GL_LINES);
            gl.Vertex(0, 0, 0);
            gl.Vertex(0, 100, 0);
            gl.End();

            gl.Color(OpenGlUtility.GetOpenGlColor(Color.Blue));
            gl.Begin(OpenGL.GL_LINES);
            gl.Vertex(0, 0, 0);
            gl.Vertex(0, 0, 100);
            gl.End();
        }
開發者ID:qqzh002,項目名稱:3DToy,代碼行數:20,代碼來源:3DToyForm.cs

示例15: CreateDisplayList

        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);
        }
開發者ID:chances,項目名稱:Animatum,代碼行數:41,代碼來源:Axies.cs


注:本文中的SharpGL.OpenGL.Vertex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。