Example #1
0
		public static void FrontFace(FrontFaceDirection mode)
		{
			Debug.Assert(Delegates.pglFrontFace != null, "pglFrontFace not implemented");
			Delegates.pglFrontFace((Int32)mode);
			CallLog("glFrontFace({0})", mode);
			DebugCheckErrors();
		}
 /// <summary> Render setup for primitive Patches from a previous RS, with optional control over various parameters of the primitive </summary>
 static public GLRenderState Patches(GLRenderState prev, int patchsize = 4, FrontFaceDirection frontface = FrontFaceDirection.Ccw, bool cullface = true, PolygonMode polygonmode = PolygonMode.Fill)
 {
     return(new GLRenderState(prev)
     {
         PatchSize = patchsize, FrontFace = frontface, CullFace = cullface, PolygonModeFrontAndBack = polygonmode
     });
 }
Example #3
0
        public static void FrontFace(FrontFaceDirection mode)
        {
#if USE_OPENGL
            OpenTK.Graphics.OpenGL.GL.FrontFace((OpenTK.Graphics.OpenGL.FrontFaceDirection)mode);
#else
            OpenTK.Graphics.ES11.GL.FrontFace((OpenTK.Graphics.ES11.All)mode);
#endif
        }
 /// <summary> Render setup for primitive Triangles with primitive restart, with optional control over various parameters of the primitive </summary>
 static public GLRenderState Tri(DrawElementsType primitiverestarttype, FrontFaceDirection frontface = FrontFaceDirection.Ccw, bool cullface = true,
                                 PolygonMode polygonmode = PolygonMode.Fill, bool polysmooth = false)
 {
     return(new GLRenderState()
     {
         PrimitiveRestart = GL4Statics.DrawElementsRestartValue(primitiverestarttype), FrontFace = frontface, CullFace = cullface, PolygonModeFrontAndBack = polygonmode, PolygonSmooth = polysmooth
     });
 }
 /// <summary> Render setup for primitive Triangles from a previous RS and with primitive restart, with optional control over various parameters of the primitive </summary>
 static public GLRenderState Tri(GLRenderState prev, uint primitiverestart, FrontFaceDirection frontface = FrontFaceDirection.Ccw, bool cullface = true,
                                 PolygonMode polygonmode = PolygonMode.Fill, bool polysmooth = false)
 {
     return(new GLRenderState(prev)
     {
         PrimitiveRestart = primitiverestart, FrontFace = frontface, CullFace = cullface, PolygonModeFrontAndBack = polygonmode, PolygonSmooth = polysmooth
     });
 }
 /// <summary> Render setup for primitive Quads from a previous RS, with optional control over various parameters of the primitive </summary>
 static public GLRenderState Quads(GLRenderState prev, FrontFaceDirection frontface = FrontFaceDirection.Ccw, bool cullface = true,
                                   PolygonMode polygonmode = PolygonMode.Fill, bool polysmooth = false)
 {
     return(new GLRenderState(prev)
     {
         FrontFace = frontface, CullFace = cullface, PolygonModeFrontAndBack = polygonmode, PolygonSmooth = polysmooth
     });
 }
Example #7
0
        public void SetFrontFaceDirection(FrontFaceDirection frontFaceDirection)
        {
            if (currentObject == null)
            {
                throw new InvalidOperationException("Called SetFrontFaceDirection while not inside an object.");
            }
            CheckStartOwnDisplayList();

            GL.FrontFace(frontFaceDirection);
        }
Example #8
0
        public static void FrontFace(FrontFaceDirection mode)
        {
#if USE_OPENGL
            if (HardwareAvailable)
            {
                OpenTK.Graphics.OpenGL.GL.FrontFace((OpenTK.Graphics.OpenGL.FrontFaceDirection)mode);
            }
#else
            OpenTK.Graphics.ES11.GL.FrontFace((OpenTK.Graphics.ES11.All)mode);
#endif
        }
Example #9
0
        private void SetFrontFace(FrontFaceDirection frontFace)
        {
            // Changing clip origin will also change the front face to compensate
            // for the flipped viewport, we flip it again here to compensate as
            // this effect is undesirable for us.
            if (_clipOrigin == ClipOrigin.UpperLeft)
            {
                frontFace = frontFace == FrontFaceDirection.Ccw ? FrontFaceDirection.Cw : FrontFaceDirection.Ccw;
            }

            GL.FrontFace(frontFace);
        }
Example #10
0
        public void UpdateMesh()
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException("OpenGLMeshRenderer");
            }
            if (_mesh == null)
            {
                throw new NullReferenceException("Mesh");
            }
            if (_mesh.Vertices == null)
            {
                throw new NullReferenceException("Mesh.Vertices");
            }

            if (_vao != null)
            {
                _shouldUpdateMesh = true;
            }

            _boundSphere = _mesh.Bounds.Sphere;

            _primitiveType = _mesh.Type;
            _frontFace     = _mesh.FrontFace;
            _polygonMode   = _mesh.DrawStyle;

            if (_mesh.Indices == null)
            {
                _verticesCount = (uint)_mesh.Vertices.Length;
                _isIndexed     = false;
            }
            else
            {
                _verticesCount = (uint)_mesh.Indices.Length;
                _isIndexed     = true;
                switch (_mesh.Indices.DataType)
                {
                case VertexAttribPointerType.UnsignedShort:
                    _indexType = DrawElementsType.UnsignedShort;
                    break;

                case VertexAttribPointerType.UnsignedInt:
                    _indexType = DrawElementsType.UnsignedInt;
                    break;

                default:
                    throw new NotSupportedException("Unknown index type: " + _mesh.Indices.DataType);
                }
            }
        }
Example #11
0
        public void SetCoordinateSystem(CoordinateSystem c)
        {
            this.coords = c;

            if (c == CoordinateSystem.RightHanded)
            {
                this.sceneTransform = Matrix4.Identity;
                this.frontFace      = FrontFaceDirection.Ccw;
            }
            else
            {
                this.sceneTransform = Matrix4.CreateScale(1, 1, -1);
                this.frontFace      = FrontFaceDirection.Cw;
            }
        }
Example #12
0
        /// <summary>
        /// Merge this state with another one.
        /// </summary>
        /// <param name="state">
        /// A <see cref="IGraphicsState"/> having the same <see cref="StateIdentifier"/> of this state.
        /// </param>
        public override void Merge(IGraphicsState state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            CullFaceState otherState = state as CullFaceState;

            if (otherState == null)
            {
                throw new ArgumentException("not a CullFaceState", "state");
            }

            _FrontFaceMode = otherState._FrontFaceMode;
            _Enabled       = otherState._Enabled;
            _CulledFace    = otherState._CulledFace;
        }
Example #13
0
        public static void FaceCulling(bool enable = true, CullFaceMode cullFaceMode = CullFaceMode.Back, FrontFaceDirection frontFace = FrontFaceDirection.Ccw)
        {
            if (enable)
            {
                if (!_faceCullingEnabled)
                {
                    GL.Enable(EnableCap.CullFace);
                }
                GL.CullFace(cullFaceMode);
                GL.FrontFace(frontFace);

                _faceCullingMode = cullFaceMode;
                _faceCullingFrontFaceDirection = frontFace;
            }
            else if (_faceCullingEnabled)
            {
                GL.Disable(EnableCap.CullFace);
            }

            _faceCullingEnabled = enable;
        }
Example #14
0
 public void SetFrontFace(FrontFace frontFace)
 {
     SetFrontFace(_frontFace = frontFace.Convert());
 }
Example #15
0
		internal static extern void glFrontFace(FrontFaceDirection mode);
Example #16
0
 public override void Reset()
 {
     Enabled            = true;
     CullFaceMode       = CullFaceMode.Back;
     FrontFaceDirection = FrontFaceDirection.Ccw;
 }
Example #17
0
 public void SetFrontFaceDirection(FrontFaceDirection frontFaceDirection)
 {
     this.frontFaceDirection = frontFaceDirection;
 }
Example #18
0
 public void FrontFace(FrontFaceDirection mode) => this.CallMethod <object>(FRONT_FACE, mode);
Example #19
0
 /// <summary>
 /// Construct a CullFaceState, specifying front face and disabling culling.
 /// </summary>
 /// <param name="frontFace">
 /// A <see cref="FrontFace"/> that determine how front faces are determined.
 /// </param>
 public CullFaceState(FrontFaceDirection frontFace)
 {
     _FrontFaceMode = frontFace;
     _Enabled       = false;
 }
Example #20
0
 public void FrontFace(FrontFaceDirection mode)
 {
     glFrontFace((int)mode);
 }
Example #21
0
 public static Reaction <T> Culling <T> (this Reaction <T> render, CullFaceMode mode = CullFaceMode.Back,
                                         FrontFaceDirection frontFace = FrontFaceDirection.Cw)
 {
     return(render.Culling(i => Tuple.Create(mode, frontFace)));
 }
Example #22
0
 public Culling()
 {
     enabled      = true;
     cullMode     = CullFaceMode.Back;
     frontFaceDir = FrontFaceDirection.Ccw;
 }
Example #23
0
 public static void qglFrontFace(FrontFaceDirection mode) => glFrontFace(mode);
Example #24
0
 public static void FrontFace(FrontFaceDirection winding)
 {
     CheckCurrent();
     _bindings.glFrontFace((int)winding);
     CheckError();
 }
Example #25
0
 public static void FrontFace(FrontFaceDirection dir)
 {
     Delegates.FrontFace(dir);
 }
Example #26
0
 internal static extern void glFrontFace(FrontFaceDirection mode);
Example #27
0
		/// <summary>
		/// Construct a CullFaceState, specifying front face and enabling culling of the specified faces.
		/// </summary>
		/// <param name="frontFace">
		/// A <see cref="FrontFaceDirection"/> that specify how front faces are determined.
		/// </param>
		/// <param name="culledFace">
		/// A <see cref="CullFaceMode"/> that specify which faces are culled.
		/// </param>
		public CullFaceState(FrontFaceDirection frontFace, CullFaceMode culledFace)
		{
			_FrontFaceMode = frontFace;
			_Enabled = true;
			_CulledFace = culledFace;
		}
Example #28
0
 public void FrontFace(FrontFaceDirection mode)
 {
     NativeMethods.FrontFace(mode);
     CheckForError();
 }
Example #29
0
 /// <summary>
 /// Construct a CullFaceState, specifying front face and enabling culling of the specified faces.
 /// </summary>
 /// <param name="frontFace">
 /// A <see cref="FrontFaceDirection"/> that specify how front faces are determined.
 /// </param>
 /// <param name="culledFace">
 /// A <see cref="CullFaceMode"/> that specify which faces are culled.
 /// </param>
 public CullFaceState(FrontFaceDirection frontFace, CullFaceMode culledFace)
 {
     _FrontFaceMode = frontFace;
     _Enabled       = true;
     _CulledFace    = culledFace;
 }
 public static extern void FrontFace( FrontFaceDirection mode );
Example #31
0
 public static void glFrontFace(FrontFaceDirection mode)
 {
     i_OpenGL1_0.glFrontFace(mode);
 }
Example #32
0
		/// <summary>
		/// Merge this state with another one.
		/// </summary>
		/// <param name="state">
		/// A <see cref="IGraphicsState"/> having the same <see cref="StateIdentifier"/> of this state.
		/// </param>
		public override void Merge(IGraphicsState state)
		{
			if (state == null)
				throw new ArgumentNullException("state");

			CullFaceState otherState = state as CullFaceState;

			if (otherState == null)
				throw new ArgumentException("not a CullFaceState", "state");

			_FrontFaceMode = otherState._FrontFaceMode;
			_Enabled = otherState._Enabled;
			_CulledFace = otherState._CulledFace;
		}
Example #33
0
 public static void FrontFace(FrontFaceDirection mode)
 {
     gl.glFrontFace((int)mode);
 }
Example #34
0
		/// <summary>
		/// Construct a CullFaceState, specifying front face and disabling culling.
		/// </summary>
		/// <param name="frontFace">
		/// A <see cref="FrontFace"/> that determine how front faces are determined.
		/// </param>
		public CullFaceState(FrontFaceDirection frontFace)
		{
			_FrontFaceMode = frontFace;
			_Enabled = false;
		}
Example #35
0
 public static void FrontFace(FrontFaceDirection mode)
 {
     Instance?.FrontFace(mode);
     CheckForError();
 }
Example #36
0
        public void SetCoordinateSystem(CoordinateSystem c)
        {
            this.coords = c;

            if (c == CoordinateSystem.RightHanded)
            {
                this.sceneTransform = Matrix4.Identity;
                this.frontFace = FrontFaceDirection.Ccw;
            }
            else
            {
                this.sceneTransform = Matrix4.CreateScale(1, 1, -1);
                this.frontFace = FrontFaceDirection.Cw;
            }
        }
Example #37
0
		public static void FrontFace(FrontFaceDirection mode)
		{
#if USE_OPENGL
			if (openGlHardwareAvailable)
			{
				OpenTK.Graphics.OpenGL.GL.FrontFace((OpenTK.Graphics.OpenGL.FrontFaceDirection)mode);
			}
#else
			OpenTK.Graphics.ES11.GL.FrontFace((OpenTK.Graphics.ES11.All)mode);
#endif
		}
Example #38
0
 public void FrontFace(FrontFaceDirection mode)
 {
     gl.glFrontFace((int)mode);
     CheckException();
 }
Example #39
0
 public static void FrontFace(FrontFaceDirection mode)
 {
     Instance?.FrontFace(mode);
 }
Example #40
0
		public static void FrontFace(FrontFaceDirection mode)
		{
			glFrontFace deleg = BaseGraphicsContext.Current.Loader.Get<glFrontFace>();
			if (deleg != null)
				deleg(mode);
		}