本文整理汇总了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);
}
示例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]);
//.........这里部分代码省略.........