当前位置: 首页>>代码示例>>C#>>正文


C# OpenGL.TexCoord方法代码示例

本文整理汇总了C#中OpenGL.TexCoord方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.TexCoord方法的具体用法?C# OpenGL.TexCoord怎么用?C# OpenGL.TexCoord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenGL的用法示例。


在下文中一共展示了OpenGL.TexCoord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetAttributes

 /// <summary>
 /// Sets the attributes.
 /// </summary>
 /// <param name="gl">The OpenGL instance.</param>
 public override void SetAttributes(OpenGL gl)
 {
     if (currentColor != null) gl.Color(currentColor.R, currentColor.G, currentColor.B, currentColor.A);
     if(currentColorIndex.HasValue) gl.Index(currentColorIndex.Value);
     if (currentNormalVector != null) gl.Normal(currentNormalVector.Value.X, currentNormalVector.Value.Y, currentNormalVector.Value.Z);
     if (currentTextureCoordiate != null) gl.TexCoord(currentTextureCoordiate.Value.U, currentTextureCoordiate.Value.V);
     if (currentRasterPosition != null) gl.RasterPos(currentRasterPosition.Value.X, currentRasterPosition.Value.X);
     //todoif (currentRasterColor != null) gl.(currentColor.R, currentColor.G, currentColor.B, currentColor.A);
     //todoif (currentRasterColorIndex != null) gl.(currentColor.R, currentColor.G, currentColor.B, currentColor.A);
     //todoif (currentRasterTextureCoordiate != null) gl.(currentColor.R, currentColor.G, currentColor.B, currentColor.A);
     if (currentEdgeFlag.HasValue) gl.EdgeFlag(currentEdgeFlag.Value ? (byte)OpenGL.GL_TRUE : (byte)OpenGL.GL_FALSE);
 }
开发者ID:cvanherk,项目名称:3d-engine,代码行数:16,代码来源:CurrentAttributes.cs

示例2: Draw

        /// <summary>
        /// This function draws the polygon.
        /// </summary>
        /// <param name="gl">OpenGL.</param>
        public override void Draw(OpenGL gl)
        {
            if(DoPreDraw(gl))
            {
                polyAttributes.Set(gl);

                foreach(Face face in faces)
                {
                    //	Begin drawing a polygon.
                    if(face.Indices.Count == 2)
                        gl.Begin(OpenGL.LINES);
                    else
                        gl.Begin(OpenGL.POLYGON);

                    foreach(Index index in face.Indices)
                    {
                        //	Set a texture coord (if any).
                        if(index.UV != -1)
                            gl.TexCoord(uvs[index.UV]);

                        //	Set a normal, or generate one.
                        if(index.Normal != -1)
                            gl.Normal(normals[index.Normal]);
                        else
                        {
                            //	Do we have enough vertices for a normal?
                            if(face.Indices.Count >= 3)
                            {
                                //	Create a normal.
                                Vertex vNormal = face.GetSurfaceNormal(this);
                                vNormal.UnitLength();

                                //	Add it to the normals, setting the index for next time.
                                index.Normal = normals.Add(new Normal(vNormal));

                                gl.Normal(vNormal);
                            }
                        }

                        //	Set the vertex.
                        gl.Vertex(vertices[index.Vertex]);
                    }

                    gl.End();
                }

                //	If the current context is edit vertices, draw the vertices.
                if(currentContext == Context.EditVertices)
                {
                    //	Push all the attributes.
                    gl.PushAttrib(OpenGL.ALL_ATTRIB_BITS);

                    //	Set the colour to red, large points, no lighting.
                    gl.Color(1, 0, 0, 1);
                    gl.PointSize(5);
                    gl.Disable(OpenGL.LIGHTING);

                    //	Draw the control points.
                    for(int point = 0; point < vertices.Count; point++)
                    {
                        //	Name the point, then draw it.
                        gl.PushName((uint)point);

                        gl.Begin(OpenGL.POINTS);
                        gl.Vertex(vertices[point]);
                        gl.End();
                        gl.PopName();
                    }

                    //	Restore the attributes.
                    gl.PopAttrib();
                }

                //	If the current context is edit normals, draw the normals.
                if(currentContext == Context.EditNormals)
                {
                    //	We're going to disable lighting.
                    Attributes.Lighting lighting = new Attributes.Lighting();
                    lighting.Enable = false;
                    lighting.Set(gl);

                    gl.Color(1, 0, 0);
                    gl.Begin(OpenGL.LINES);

                    //	Draw the normals points.
                    foreach(Face face in faces)
                    {
                        foreach(Index index in face.Indices)
                        {
                            if(index.Normal == -1)
                                continue;
                            //	Translate to that vertex.
                            Vertex v = vertices[index.Vertex];
                            gl.PushName((uint)index.Normal);
                            gl.Vertex(v);
                            gl.Vertex(v + normals[index.Normal]);
//.........这里部分代码省略.........
开发者ID:nromik,项目名称:sharpgl,代码行数:101,代码来源:Polygon.cs


注:本文中的OpenGL.TexCoord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。