Enable() private method

private Enable ( uint cap ) : void
cap uint
return void
Ejemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="arg"></param>
        protected override void DoRender(RenderEventArgs arg)
        {
            //  Set the projection matrix.(projection and view matrix actually.)
            OpenGL.MatrixMode(OpenGL.GL_PROJECTION);
            OpenGL.LoadIdentity();
            arg.Camera.LegacyProjection();

            //  Set the modelview matrix.(just model matrix actually.)
            OpenGL.MatrixMode(OpenGL.GL_MODELVIEW);
            OpenGL.LoadIdentity();
            this.LegacyTransform();

            vec4 color = this.CurveColor.ToVec4();

            OpenGL.Color(color.x, color.y, color.z, color.w);
            this.CurveWidth.On();

            //启用求值器
            //必须在绘制顶点之前开启
            OpenGL.Enable(OpenGL.GL_MAP2_VERTEX_3);
            OpenGL.Enable(OpenGL.GL_AUTO_NORMAL);
            // 计算网格
            OpenGL.EvalMesh2(
                (uint)this.MeshMode,
                this.MinPercent.x, this.MaxPercent.x, this.MinPercent.y, this.MaxPercent.y);

            this.CurveWidth.Off();
        }
Ejemplo n.º 2
0
        //int m_ParticleSize = 30;
        /// <summary>
        ///
        /// </summary>
        protected override void SwitchOn()
        {
            int count = this.SwitchList.Count;

            for (int i = 0; i < count; i++)
            {
                this.SwitchList[i].On();
            }

            OpenGL.Enable(OpenGL.GL_VERTEX_PROGRAM_POINT_SIZE);
            OpenGL.Enable(OpenGL.GL_POINT_SPRITE_ARB);
            OpenGL.TexEnv(OpenGL.GL_POINT_SPRITE_ARB, OpenGL.GL_COORD_REPLACE_ARB, OpenGL.GL_TRUE);
            OpenGL.Hint(OpenGL.GL_POINT_SMOOTH_HINT, OpenGL.GL_NICEST);
            //GL.GetDelegateFor<GL.glBlendEquation>()(GL.GL_FUNC_ADD_EXT);
            //GL.GetDelegateFor<GL.glBlendFuncSeparate>()(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE);

            //float[] quadratic = { 1.0f, 0, 0, 1.0f };
            //GL.PointParameter(GL.GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic);
            //GL.PointParameter(GL.GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0f);
            //GL.TexEnvf(GL.GL_POINT_SPRITE_ARB, GL.GL_COORD_REPLACE_ARB, GL.GL_TRUE);

            //GL.PointParameter(GL.GL_POINT_SIZE_MIN_ARB, m_ParticleSize);
            ////GL.TexEnvi(GL.GL_POINT_SPRITE, GL.GL_COORD_REPLACE, GL.GL_TRUE);
            //GL.PointParameter(GL.GL_POINT_SPRITE_COORD_ORIGIN, GL.GL_LOWER_LEFT);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="arg"></param>
        protected override void DoRender(RenderEventArgs arg)
        {
            //  Set the projection matrix.(projection and view matrix actually.)
            OpenGL.MatrixMode(OpenGL.GL_PROJECTION);
            OpenGL.LoadIdentity();
            arg.Camera.LegacyProjection();

            //  Set the modelview matrix.(just model matrix actually.)
            OpenGL.MatrixMode(OpenGL.GL_MODELVIEW);
            OpenGL.LoadIdentity();
            this.LegacyTransform();

            //必须在绘制顶点之前开启
            OpenGL.Enable(OpenGL.GL_MAP1_VERTEX_3);

            vec4 color = this.CurveColor.ToVec4();

            OpenGL.Color(color.x, color.y, color.z, color.w);
            this.CurveWidth.On();

            OpenGL.Begin(this.CurveDrawMode);
            float granularity = this.Granularity;

            for (float i = this.MinPercent; i <= this.MaxPercent; i += granularity)
            {
                OpenGL.EvalCoord1f((float)i);
            }
            OpenGL.End();

            this.CurveWidth.Off();
        }
Ejemplo n.º 4
0
 protected override void SwitchOff()
 {
     if (this.enableCapacityWhenSwitchOn)
     {
         if (!this.originalEnableCapacity)
         {
             OpenGL.Disable(Capacity);
         }
     }
     else
     {
         if (this.originalEnableCapacity)
         {
             OpenGL.Enable(Capacity);
         }
     }
 }
Ejemplo n.º 5
0
 protected override void SwitchOn()
 {
     this.enableCapacityWhenSwitchOn = this.EnableCapacity;
     this.originalEnableCapacity     = OpenGL.IsEnabled(this.Capacity) != 0;
     if (this.enableCapacityWhenSwitchOn)
     {
         if (!this.originalEnableCapacity)
         {
             OpenGL.Enable(Capacity);
         }
     }
     else
     {
         if (this.originalEnableCapacity)
         {
             OpenGL.Disable(Capacity);
         }
     }
 }
Ejemplo n.º 6
0
        private void CreateRenderContext()
        {
            // Initialises OpenGL.
            var renderContext = new FBORenderContext();

            //  Create the render context.
            renderContext.Create(OpenGLVersion, Width, Height, 32, null);

            this.renderContext = renderContext;

            renderContext.MakeCurrent();

            //  Set the most basic OpenGL styles.
            OpenGL.ShadeModel(OpenGL.GL_SMOOTH);
            // 天蓝色背景
            OpenGL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f);
            OpenGL.ClearDepth(1.0f);
            OpenGL.Enable(OpenGL.GL_DEPTH_TEST);
            OpenGL.DepthFunc(OpenGL.GL_LEQUAL);
            OpenGL.Hint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void CreateRenderContext()
        {
            // Initialises OpenGL.
            var renderContext = new FBORenderContext();

            //  Create the render context.
            renderContext.Create(Width, Height, 32, null);

            this.renderContext = renderContext;

            renderContext.MakeCurrent();

            //  Set the most basic OpenGL styles.
            OpenGL.ShadeModel(OpenGL.GL_SMOOTH);
            OpenGL.ClearDepth(1.0f);
            OpenGL.Enable(OpenGL.GL_DEPTH_TEST);
            OpenGL.DepthFunc(OpenGL.GL_LEQUAL);
            OpenGL.Hint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST);
            if (this.designMode)
            {
                GLCanvasHelper.ResizeGL(this.Width, this.Height);
            }
        }