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


C# OpenGL.PolygonMode方法代码示例

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


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

示例1: SetAttributes

 /// <summary>
 /// Sets the attributes.
 /// </summary>
 /// <param name="gl">The OpenGL instance.</param>
 public override void SetAttributes(OpenGL gl)
 {
     if (enableCullFace.HasValue) gl.EnableIf(OpenGL.GL_CULL_FACE, enableCullFace.Value);
     if(cullFaceMode.HasValue) gl.CullFace((uint)cullFaceMode.Value);
     if(enableSmooth.HasValue) gl.EnableIf(OpenGL.GL_POLYGON_SMOOTH, enableSmooth.Value);
     if(frontFaceMode.HasValue) gl.FrontFace((uint)frontFaceMode.Value);
     if(polygonMode.HasValue) gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, (uint)polygonMode.Value);
     if(offsetFactor.HasValue && offsetBias.HasValue) gl.PolygonOffset(offsetFactor.Value, offsetBias.Value);
     if(enableOffsetPoint.HasValue) gl.EnableIf(OpenGL.GL_POLYGON_OFFSET_POINT, enableOffsetPoint.Value);
     if(enableOffsetLine.HasValue) gl.EnableIf(OpenGL.GL_POLYGON_OFFSET_LINE, enableOffsetLine.Value);
     if(enableOffsetFill.HasValue) gl.EnableIf(OpenGL.GL_POLYGON_OFFSET_FILL, enableOffsetFill.Value);
 }
开发者ID:hhool,项目名称:sharpgl,代码行数:16,代码来源:PolygonAttributes.cs

示例2: Render

        /// <summary>
        /// Render to the provided instance of OpenGL.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        /// <param name="renderMode">The render mode.</param>
        public void Render(OpenGL gl, RenderMode renderMode)
        {
            //  Push attributes, disable lighting.
            gl.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT |
                OpenGL.GL_LINE_BIT | OpenGL.GL_POLYGON_BIT);
            gl.Disable(OpenGL.GL_LIGHTING);
            gl.Disable(OpenGL.GL_TEXTURE_2D);
            gl.LineWidth(1.0f);
            gl.Color(1f, 0.2f, 0.2f, 0.6f);
            gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, 
                renderMode == RenderMode.HitTest ? (uint)PolygonMode.Filled : (uint)PolygonMode.Lines);
            
            gl.Begin(OpenGL.GL_QUADS);		// Draw The Cube Using quads
            gl.Vertex(hhl);	// Top Right Of The Quad (Top)
            gl.Vertex(lhl);	// Top Left Of The Quad (Top)
            gl.Vertex(lhh);	// Bottom Left Of The Quad (Top)
            gl.Vertex(hhh);	// Bottom Right Of The Quad (Top)
            gl.Vertex(hlh);	// Top Right Of The Quad (Bottom)
            gl.Vertex(llh);	// Top Left Of The Quad (Bottom)
            gl.Vertex(lll);	// Bottom Left Of The Quad (Bottom)
            gl.Vertex(hll);	// Bottom Right Of The Quad (Bottom)
            gl.Vertex(hhh);	// Top Right Of The Quad (Front)
            gl.Vertex(lhh);	// Top Left Of The Quad (Front)
            gl.Vertex(llh);	// Bottom Left Of The Quad (Front)
            gl.Vertex(hlh);	// Bottom Right Of The Quad (Front)
            gl.Vertex(hll);	// Top Right Of The Quad (Back)
            gl.Vertex(lll);	// Top Left Of The Quad (Back)
            gl.Vertex(lhl);	// Bottom Left Of The Quad (Back)
            gl.Vertex(hhl);	// Bottom Right Of The Quad (Back)
            gl.Vertex(lhh);	// Top Right Of The Quad (Left)
            gl.Vertex(lhl);	// Top Left Of The Quad (Left)
            gl.Vertex(lll);	// Bottom Left Of The Quad (Left)
            gl.Vertex(llh);	// Bottom Right Of The Quad (Left)
            gl.Vertex(hhl);	// Top Right Of The Quad (Right)
            gl.Vertex(hhh);	// Top Left Of The Quad (Right)
            gl.Vertex(hlh);	// Bottom Left Of The Quad (Right)
            gl.Vertex(hll);	// Bottom Right Of The Quad (Right)
            gl.End();			// End Drawing The Cube

            //  Pop attributes.
            gl.PopAttrib();
        }
开发者ID:cvanherk,项目名称:3d-engine,代码行数:47,代码来源:BoundingVolume.cs

示例3: RenderImmediateMode

        /// <summary>
        /// Renders the scene in immediate mode.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        public void RenderImmediateMode(OpenGL gl)
        {
            //  Setup the modelview matrix.
            gl.MatrixMode(OpenGL.GL_MODELVIEW);
            gl.LoadIdentity();
            gl.MultMatrix(modelviewMatrix.to_array());

            //  Push the polygon attributes and set line mode.
            gl.PushAttrib(OpenGL.GL_POLYGON_BIT);
            gl.PolygonMode(FaceMode.FrontAndBack, PolygonMode.Lines);

            //  Render the trefoil.
            var vertices = trefoilKnot.Vertices;
            gl.Begin(BeginMode.Triangles);
            foreach (var index in trefoilKnot.Indices)
                gl.Vertex(vertices[index].x, vertices[index].y, vertices[index].z);
            gl.End();

            //  Pop the attributes, restoring all polygon state.
            gl.PopAttrib();
        }
开发者ID:chantsunman,项目名称:sharpgl,代码行数:25,代码来源:Scene.cs

示例4: Set

        public override void Set(OpenGL gl)
        {
            base.Set(gl);

            gl.PushAttrib(AttributeBit);

            gl.EnableIf(OpenGL.CULL_FACE, enableCullFace);
            gl.EnableIf(OpenGL.POLYGON_SMOOTH, enableSmooth);
            //	gl.glCullFace((uint)cullFaceMode);
            //	gl.glFrontFace((uint)frontFaceMode);
            gl.PolygonMode(OpenGL.FRONT_AND_BACK, (uint)polygonMode);
            //	gl.glPolygonOffset(offsetFactor, offsetBias);
            gl.EnableIf(OpenGL.POLYGON_OFFSET_POINT, enableOffsetPoint);
            gl.EnableIf(OpenGL.POLYGON_OFFSET_LINE, enableOffsetLine);
            gl.EnableIf(OpenGL.POLYGON_OFFSET_FILL, enableOffsetFill);
        }
开发者ID:nromik,项目名称:sharpgl,代码行数:16,代码来源:Attributes.cs


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