Commits

Tobias Bohnen committed 4333ad3

Comments (0)

Files changed (21)

CgNet/D3D9/CgD3D9.cs

             {
                 foreach (var profile in Cg.SupportedProfiles)
                 {
-                    if (IsProfileSupported(profile))
+                    if (profile.IsSupported())
                     {
                         yield return profile;
                     }
             return NativeMethods.cgD3D9GetLatestVertexProfile();
         }
 
-        public static string[] GetOptimalOptions(ProfileType profile)
+        public static string[] GetOptimalOptions(this ProfileType profile)
         {
             return Cg.IntPtrToStringArray(NativeMethods.cgD3D9GetOptimalOptions(profile));
         }
 
-        public static bool IsProfileSupported(ProfileType profile)
+        public static bool IsSupported(this ProfileType profile)
         {
             return NativeMethods.cgD3D9IsProfileSupported(profile);
         }
 
-        public static DeclarationUsage ResourceTypeToDeclarationUsage(ResourceType resourceType)
+        public static DeclarationUsage ResourceTypeToDeclarationUsage(this ResourceType resourceType)
         {
             return (DeclarationUsage)NativeMethods.cgD3D9ResourceToDeclUsage(resourceType);
         }
             return Marshal.PtrToStringAnsi(NativeMethods.cgD3D9TranslateHRESULT(result.Code));
         }
 
-        public static int TypeToSize(ParameterType type)
+        public static int TypeToSize(this ParameterType type)
         {
             return (int)NativeMethods.cgD3D9TypeToSize(type);
         }
             {
                 foreach (var profile in Cg.SupportedProfiles)
                 {
-                    if (IsProfileSupported(profile))
+                    if (profile.IsSupported())
                     {
                         yield return profile;
                     }
             return NativeMethods.cgGLDetectGLSLVersion();
         }
 
-        public static void DisableProfile(ProfileType profile)
+        public static void Disable(this ProfileType profile)
         {
             NativeMethods.cgGLDisableProfile(profile);
         }
 
-        public static void EnableProfile(ProfileType profile)
+        public static void Enable(this ProfileType profile)
         {
             NativeMethods.cgGLEnableProfile(profile);
         }
         /// </summary>
         /// <param name="profileClass">The class of profile that will be returned.</param>
         /// <returns>Returns a profile enumerant for the latest profile of the given class. Returns CG_PROFILE_UNKNOWN if no appropriate profile is available or an error occurs.</returns>
-        public static ProfileType GetLatestProfile(ProfileClass profileClass)
+        public static ProfileType GetLatestProfile(this ProfileClass profileClass)
         {
             return NativeMethods.cgGLGetLatestProfile(profileClass);
         }
 
-        public static string[] GetOptimalOptions(ProfileType profile)
+        public static string[] GetOptimalOptions(this ProfileType profile)
         {
             return Cg.IntPtrToStringArray(NativeMethods.cgGLGetOptimalOptions(profile));
         }
 
-        public static bool IsProfileSupported(ProfileType profile)
+        public static bool IsSupported(this ProfileType profile)
         {
             return NativeMethods.cgGLIsProfileSupported(profile);
         }
             NativeMethods.cgGLSetDebugMode(debug);
         }
 
-        public static void SetOptimalOptions(ProfileType profile)
+        public static void SetOptimalOptions(this ProfileType profile)
         {
             NativeMethods.cgGLSetOptimalOptions(profile);
         }
 
-        public static void UnbindProgram(ProfileType profile)
+        public static void UnbindProgram(this ProfileType profile)
         {
             NativeMethods.cgGLUnbindProgram(profile);
         }

ExampleBrowser/Examples/OpenTK/Advanced/GsShrinky.cs

 
             // Enable all profiles needed
             for (int i = 0; i < combinedProgram.DomainsCount - 1; i++)
-                CgGL.EnableProfile(combinedProgram.GetProgramDomainProfile(i));
+                combinedProgram.GetProgramDomainProfile(i).Enable();
 
             DrawStars();
 
             // Disable all profiles needed
             for (int i = combinedProgram.DomainsCount - 1; i >= 0; i--)
-                CgGL.DisableProfile(combinedProgram.GetProgramDomainProfile(i));
+                combinedProgram.GetProgramDomainProfile(i).Disable();
 
             if (myShrinkFactor > 0.8)
             {

ExampleBrowser/Examples/OpenTK/Advanced/GsSimple.cs

         {
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
-            CgGL.EnableProfile(vertexProfile);
-            CgGL.EnableProfile(geometryProfile);
-            CgGL.EnableProfile(fragmentProfile);
+            vertexProfile.Enable();
+            geometryProfile.Enable();
+            fragmentProfile.Enable();
 
             if (combinedProgram != null)
             {
 
             DrawStars();
 
-            CgGL.DisableProfile(vertexProfile);
-            CgGL.DisableProfile(geometryProfile);
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            geometryProfile.Disable();
+            fragmentProfile.Disable();
             SwapBuffers();
         }
 
             geometryProfile = CgGL.GetLatestProfile(ProfileClass.Geometry);
             if (geometryProfile == ProfileType.Unknown)
             {
-                if (CgGL.IsProfileSupported(ProfileType.GlslG))
+                if (ProfileType.GlslG.IsSupported())
                     geometryProfile = ProfileType.GlslG;
                 else
                 {

ExampleBrowser/Examples/OpenTK/Advanced/IncludeString.cs

         {
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
-            this.vertexProgram.Bind();
-
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
             /* Rendering code verbatim from Chapter 1, Section 2.4.1 "Rendering
                a Triangle with OpenGL" (page 57). */
             GL.Vertex2(0.0f, -0.8f);
             GL.End();
 
-            CgGL.DisableProfile(this.vertexProfile);
+            vertexProfile.Disable();
             this.SwapBuffers();
         }
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
             this.CgContext.SetCompilerIncludeString("shader/output.cg",
             @"
                 return OUT;
             }");
 
-            this.vertexProgram =
+            vertexProgram =
               this.CgContext.CreateProgram(
                 ProgramType.Source,                 /* Program in human-readable form */
                "#include \"vertexProgram.cg\"\n",
-                this.vertexProfile,         /* Profile: OpenGL ARB vertex program */
+                vertexProfile,         /* Profile: OpenGL ARB vertex program */
                 "vertexProgram",           /* Entry function name */
                 Args);                    /* Include path options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
         }
 
         /// <summary>
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
+            vertexProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/Bulge.cs

                               0, 1, 0,
                               viewMatrix);
 
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             vertexProgram.Bind();
 
             vertexProgram.UpdateParameters();
             NativeMethods.glutSolidSphere(0.1, 12, 12);
 
-            CgGL.DisableProfile(vertexProfile);
+            vertexProfile.Disable();
 
-            CgGL.DisableProfile(fragmentProfile);
+            fragmentProfile.Disable();
 
             this.SwapBuffers();
         }
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             this.vertexParamModelViewProj = vertexProgram.GetNamedParameter("modelViewProj");
             this.vertexParamTime = vertexProgram.GetNamedParameter("time");
             this.vertexParamFrequency.Set(2.4f);
             this.vertexParamShininess.Set(35f);
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgram(
                     ProgramType.Source, /* Program in human-readable form */
                     "float4 main(float4 c : COLOR) : COLOR { return c; }",
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     "main", /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             /* Specify vertex program for rendering the light source with a string. */
             this.lightVertexProgram =
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.lightVertexProgram.Dispose();
             this.CgContext.Dispose();
         }

ExampleBrowser/Examples/OpenTK/Basic/BumpMapWall.cs

 
             this.vertexParamLightPosition.Set(lightPosition);
 
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
             fragmentProgram.Bind();
 
             this.fragmentParamNormalMap.EnableTexture();
             this.fragmentParamNormalizeCube.EnableTexture();
 
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             vertexProgram.UpdateParameters();
             fragmentProgram.UpdateParameters();
             GL.Vertex2(-7f, 7f);
             GL.End();
 
-            CgGL.DisableProfile(vertexProfile);
+            vertexProfile.Disable();
 
-            CgGL.DisableProfile(fragmentProfile);
+            fragmentProfile.Disable();
 
             /*** Render light as white ball using fixed function pipe ***/
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             this.vertexParamLightPosition =
                 vertexProgram.GetNamedParameter("lightPosition");
             this.vertexParamModelViewProj =
                 vertexProgram.GetNamedParameter("modelViewProj");
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName, /* Name of file containing program */
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             this.fragmentParamNormalMap =
                 fragmentProgram.GetNamedParameter("normalMap");
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/FragmentLighting.cs

         private double myLightAngle = -0.4f; /* Angle light rotates around scene. */
         private ProfileType vertexProfile, fragmentProfile;
         private Program vertexProgram, fragmentProgram;
-        private string VertexProgramFileName = "Data/C5E2v_fragmentLighting.cg",
-            /* Page 124 */    VertexProgramName = "C5E2v_fragmentLighting",
-                  FragmentProgramFileName = "Data/C5E3f_basicLight.cg",
-            /* Page 125 */    FragmentProgramName = "C5E3f_basicLight";
+        private string vertexProgramFileName = "Data/C5E2v_fragmentLighting.cg",
+            /* Page 124 */    vertexProgramName = "C5E2v_fragmentLighting",
+                  fragmentProgramFileName = "Data/C5E3f_basicLight.cg",
+            /* Page 125 */    fragmentProgramName = "C5E3f_basicLight";
 
         #endregion Fields
 
                               0, 1, 0,
                               viewMatrix);
 
-            this.vertexProgram.Bind();
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
-            this.fragmentProgram.Bind();
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProgram.Bind();
+            fragmentProfile.Enable();
 
             this.setBrassMaterial();
 
 
             /* Set matrix parameter with row-major matrix. */
             this.myCgVertexParam_modelViewProj.SetMatrix(modelViewProjMatrix);
-            this.vertexProgram.UpdateParameters();
-            this.fragmentProgram.UpdateParameters();
+            vertexProgram.UpdateParameters();
+            fragmentProgram.UpdateParameters();
             NativeMethods.glutSolidSphere(2.0, 40, 40);
 
             /*** Render red plastic solid cone ***/
 
             /* Set matrix parameter with row-major matrix. */
             this.myCgVertexParam_modelViewProj.SetMatrix(modelViewProjMatrix);
-            this.vertexProgram.UpdateParameters();
-            this.fragmentProgram.UpdateParameters();
+            vertexProgram.UpdateParameters();
+            fragmentProgram.UpdateParameters();
             NativeMethods.glutSolidCone(1.5, 3.5, 30, 30);
 
             /*** Render light as emissive white ball ***/
 
             /* Set matrix parameter with row-major matrix. */
             this.myCgVertexParam_modelViewProj.SetMatrix(modelViewProjMatrix);
-            this.vertexProgram.UpdateParameters();
-            this.fragmentProgram.UpdateParameters();
+            vertexProgram.UpdateParameters();
+            fragmentProgram.UpdateParameters();
             NativeMethods.glutSolidSphere(0.2, 12, 12);
 
-            CgGL.DisableProfile(this.vertexProfile);
-            CgGL.DisableProfile(this.fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
 
             this.SwapBuffers();
         }
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
-                    this.VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
-                    this.VertexProgramName, /* Entry function name */
+                    vertexProgramFileName, /* Name of file containing program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
-            this.myCgVertexParam_modelViewProj = this.vertexProgram.GetNamedParameter("modelViewProj");
+            this.myCgVertexParam_modelViewProj = vertexProgram.GetNamedParameter("modelViewProj");
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
             /* Specify "color passthrough" fragment program with a string. */
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
-                    this.FragmentProgramFileName,
-                    this.fragmentProfile, /* Profile: latest fragment profile */
-                    this.FragmentProgramName, /* Entry function name */
+                    fragmentProgramFileName,
+                    fragmentProfile, /* Profile: latest fragment profile */
+                    fragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
-            this.myCgFragmentParam_globalAmbient = this.fragmentProgram.GetNamedParameter("globalAmbient");
-            this.myCgFragmentParam_lightColor = this.fragmentProgram.GetNamedParameter("lightColor");
-            this.myCgFragmentParam_lightPosition = this.fragmentProgram.GetNamedParameter("lightPosition");
-            this.myCgFragmentParam_eyePosition = this.fragmentProgram.GetNamedParameter("eyePosition");
-            this.myCgFragmentParam_Ke = this.fragmentProgram.GetNamedParameter("Ke");
-            this.myCgFragmentParam_Ka = this.fragmentProgram.GetNamedParameter("Ka");
-            this.myCgFragmentParam_Kd = this.fragmentProgram.GetNamedParameter("Kd");
-            this.myCgFragmentParam_Ks = this.fragmentProgram.GetNamedParameter("Ks");
-            this.myCgFragmentParam_shininess = this.fragmentProgram.GetNamedParameter("shininess");
+            this.myCgFragmentParam_globalAmbient = fragmentProgram.GetNamedParameter("globalAmbient");
+            this.myCgFragmentParam_lightColor = fragmentProgram.GetNamedParameter("lightColor");
+            this.myCgFragmentParam_lightPosition = fragmentProgram.GetNamedParameter("lightPosition");
+            this.myCgFragmentParam_eyePosition = fragmentProgram.GetNamedParameter("eyePosition");
+            this.myCgFragmentParam_Ke = fragmentProgram.GetNamedParameter("Ke");
+            this.myCgFragmentParam_Ka = fragmentProgram.GetNamedParameter("Ka");
+            this.myCgFragmentParam_Kd = fragmentProgram.GetNamedParameter("Kd");
+            this.myCgFragmentParam_Ks = fragmentProgram.GetNamedParameter("Ks");
+            this.myCgFragmentParam_shininess = fragmentProgram.GetNamedParameter("shininess");
 
             /* Set light source color parameters once. */
             this.myCgFragmentParam_globalAmbient.Set(this.myGlobalAmbient);
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/ParticleSystem.cs

 
             vertexProgram.Bind();
 
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             /* Render live particles. */
             GL.Begin(BeginMode.Points);
             }
             GL.End();
 
-            CgGL.DisableProfile(vertexProfile);
+            vertexProfile.Disable();
 
-            CgGL.DisableProfile(fragmentProfile);
+            fragmentProfile.Disable();
 
             SwapBuffers();
         }
                     fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
         }
 
         /// <summary>
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
+            vertexProgram.Dispose();
             fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }

ExampleBrowser/Examples/OpenTK/Basic/ProjectiveTexturing.cs

                   up[0], -up[1], up[2],
                   lightViewMatrix);
 
-            this.vertexProgram.Bind();
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
-            this.fragmentProgram.Bind();
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProgram.Bind();
+            fragmentProfile.Enable();
 
             /* modelView = rotateMatrix * translateMatrix */
             MakeRotateMatrix(70, 1, 1, 1, rotateMatrix);
             /* Set matrix parameter with row-major matrix. */
             this.myCgVertexParamModelViewProj.SetMatrix(modelViewProjMatrix);
             this.myCgVertexParamTextureMatrix.SetMatrix(textureMatrix);
-            this.vertexProgram.UpdateParameters();
-            this.fragmentProgram.UpdateParameters();
+            vertexProgram.UpdateParameters();
+            fragmentProgram.UpdateParameters();
             NativeMethods.glutSolidSphere(2.0, 40, 40);
 
             /*** Render solid cube ***/
             /* Set matrix parameter with row-major matrix. */
             this.myCgVertexParamModelViewProj.SetMatrix(modelViewProjMatrix);
             this.myCgVertexParamTextureMatrix.SetMatrix(textureMatrix);
-            this.vertexProgram.UpdateParameters();
-            this.fragmentProgram.UpdateParameters();
+            vertexProgram.UpdateParameters();
+            fragmentProgram.UpdateParameters();
             NativeMethods.glutSolidCube(2.5);
 
             /*** Render floor ***/
 
             GL.Disable(EnableCap.CullFace);
 
-            CgGL.DisableProfile(vertexProfile);
+            vertexProfile.Disable();
 
-            CgGL.DisableProfile(fragmentProfile);
+            fragmentProfile.Disable();
 
             /*** Render light as white cone ***/
 
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
             this.CgContext.SetManageTextureParameters(true);
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
-            this.myCgVertexParamModelViewProj = this.vertexProgram.GetNamedParameter("modelViewProj");
-            this.myCgVertexParamLightPosition = this.vertexProgram.GetNamedParameter("lightPosition");
-            this.myCgVertexParamKd = this.vertexProgram.GetNamedParameter("Kd");
-            this.myCgVertexParamTextureMatrix = this.vertexProgram.GetNamedParameter("textureMatrix");
+            this.myCgVertexParamModelViewProj = vertexProgram.GetNamedParameter("modelViewProj");
+            this.myCgVertexParamLightPosition = vertexProgram.GetNamedParameter("lightPosition");
+            this.myCgVertexParamKd = vertexProgram.GetNamedParameter("Kd");
+            this.myCgVertexParamTextureMatrix = vertexProgram.GetNamedParameter("textureMatrix");
 
             /* Set light source color parameters once. */
             this.myCgVertexParamKd.Set(this.kd);
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
             /* Specify "color passthrough" fragment program with a string. */
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName,
-                    this.fragmentProfile, /* Profile: latest fragment profile */
+                    fragmentProfile, /* Profile: latest fragment profile */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
             this.SetupDemonSampler();
         }
 
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 
             GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, 0x812D);
             GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, 0x812D);
 
-            Parameter sampler = this.fragmentProgram.GetNamedParameter("projectiveMap");
+            Parameter sampler = fragmentProgram.GetNamedParameter("projectiveMap");
             sampler.SetTexture(Texobj);
         }
 

ExampleBrowser/Examples/OpenTK/Basic/SpecularBumpMap.cs

             myCgVertexParam_lightPosition.Set3(lightPosition);
             myCgVertexParam_eyePosition.Set3(eyePosition);
 
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
             fragmentProgram.Bind();
             myCgFragmentParam_normalMap.EnableTexture();
             myCgFragmentParam_normalizeCube.EnableTexture();
 
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             vertexProgram.UpdateParameters();
             fragmentProgram.UpdateParameters();
             GL.TexCoord2(0f,1f); GL.Vertex2(-7f, 7f);
             GL.End();
 
-            CgGL.DisableProfile(vertexProfile);
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
             /*** Render light as white ball using fixed function pipe ***/
 
             GL.Translate(lightPosition[0], lightPosition[1], lightPosition[2]);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
             this.CgContext.SetManageTextureParameters(true);
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             this.myCgVertexParam_lightPosition =
                 vertexProgram.GetNamedParameter("lightPosition");
             this.myCgVertexParam_modelViewProj =
                 vertexProgram.GetNamedParameter("modelViewProj");
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName, /* Name of file containing program */
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             myCgFragmentParam_ambient =
-                this.fragmentProgram.GetNamedParameter("ambient");
+                fragmentProgram.GetNamedParameter("ambient");
             myCgFragmentParam_ambient.Set(0.2f);
 
             myCgFragmentParam_LMd =
-                this.fragmentProgram.GetNamedParameter("LMd");
+                fragmentProgram.GetNamedParameter("LMd");
             myCgFragmentParam_LMd.Set(0.8f, 0.7f, 0.2f);
 
             myCgFragmentParam_LMs =
-                this.fragmentProgram.GetNamedParameter("LMs");
+                fragmentProgram.GetNamedParameter("LMs");
             myCgFragmentParam_LMs.Set(0.5f, 0.5f, 0.8f);
 
             myCgFragmentParam_normalMap =
-                this.fragmentProgram.GetNamedParameter("normalMap");
+                fragmentProgram.GetNamedParameter("normalMap");
 
             myCgFragmentParam_normalizeCube =
-                this.fragmentProgram.GetNamedParameter("normalizeCube");
+                fragmentProgram.GetNamedParameter("normalizeCube");
 
             myCgFragmentParam_normalizeCube2 =
-                this.fragmentProgram.GetNamedParameter("normalizeCube2");
+                fragmentProgram.GetNamedParameter("normalizeCube2");
 
             myCgFragmentParam_normalMap.SetTexture(texObj[1]);
             myCgFragmentParam_normalizeCube.SetTexture(texObj[0]);
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/TextureSampling.cs

             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
             vertexProgram.Bind();
-
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
             fragmentProgram.Bind();
-
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             this.fragmentParamDecal.EnableTexture();
 
             GL.Vertex2(0.0f, -0.8f);
             GL.End();
 
-            CgGL.DisableProfile(vertexProfile);
+            vertexProfile.Disable();
 
-            CgGL.DisableProfile(fragmentProfile);
+            fragmentProfile.Disable();
 
             this.fragmentParamDecal.DisableTexture();
 
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
 
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             this.fragmentParamDecal = fragmentProgram.GetNamedParameter("decal");
 

ExampleBrowser/Examples/OpenTK/Basic/TwoTextureAccesses.cs

                 this.vertexParamRightSeparation.Set(0, mySeparation);
             }
 
-            this.vertexProgram.Bind();
+            vertexProgram.Bind();
 
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProfile.Enable();
 
-            this.fragmentProgram.Bind();
+            fragmentProgram.Bind();
 
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProfile.Enable();
 
             this.fragmentParamDecal.EnableTexture();
 
             GL.Vertex2(0.0f, -0.8f);
             GL.End();
 
-            CgGL.DisableProfile(this.vertexProfile);
+            vertexProfile.Enable();
 
-            CgGL.DisableProfile(this.fragmentProfile);
+            fragmentProfile.Disable();
 
             this.fragmentParamDecal.DisableTexture();
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             this.vertexParamLeftSeparation =
                 vertexProgram.GetNamedParameter("leftSeparation");
             this.vertexParamRightSeparation =
                 vertexProgram.GetNamedParameter("rightSeparation");
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName, /* Name of file containing program */
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             this.fragmentParamDecal =
-                this.fragmentProgram.GetNamedParameter("decal");
+                fragmentProgram.GetNamedParameter("decal");
 
             this.fragmentParamDecal.SetTexture(666);
         }
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/UniformParameter.cs

             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
             vertexProgram.Bind();
-
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
             fragmentProgram.Bind();
-
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             DrawStars();
 
-            CgGL.DisableProfile(vertexProfile);
-
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
             SwapBuffers();
         }
 
                     fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
         }
 
         /// <summary>

ExampleBrowser/Examples/OpenTK/Basic/VaryingParameter.cs

         {
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
-            this.vertexProgram.Bind();
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
-            CgGL.EnableProfile(this.vertexProfile);
-
-            this.fragmentProgram.Bind();
-
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProgram.Bind();
+            fragmentProfile.Enable();
 
             GL.Begin(BeginMode.Triangles);
             GL.Color3(1f, 0f, 0f); /* Red */
             GL.Vertex2(0.0f, -0.8f);
             GL.End();
 
-            CgGL.DisableProfile(this.vertexProfile);
-
-            CgGL.DisableProfile(this.fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
             this.SwapBuffers();
         }
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName, /* Name of file containing program */
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
         }
 
         /// <summary>
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/VertexAndFragmentProgram.cs

             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
             vertexProgram.Bind();
-
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
             fragmentProgram.Bind();
-
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             DrawStars();
 
-            CgGL.DisableProfile(vertexProfile);
-
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
             SwapBuffers();
         }
 
                     fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
         }
 
         /// <summary>

ExampleBrowser/Examples/OpenTK/Basic/VertexLighting.cs

                               viewMatrix);
 
             vertexProgram.Bind();
-            CgGL.EnableProfile(vertexProfile);
+            vertexProfile.Enable();
 
             fragmentProgram.Bind();
-            CgGL.EnableProfile(fragmentProfile);
+            fragmentProfile.Enable();
 
             setBrassMaterial();
 
             vertexProgram.UpdateParameters();
             NativeMethods.glutSolidSphere(0.2, 12, 12);
 
-            CgGL.DisableProfile(vertexProfile);
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
 
             this.SwapBuffers();
         }
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/VertexProgram.cs

         {
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
-            this.vertexProgram.Bind();
-
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
             /* Rendering code verbatim from Chapter 1, Section 2.4.1 "Rendering
                a Triangle with OpenGL" (page 57). */
             GL.Vertex2(0.0f, -0.8f);
             GL.End();
 
-            CgGL.DisableProfile(this.vertexProfile);
+            vertexProfile.Disable();
             this.SwapBuffers();
         }
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
 
-            this.vertexProgram.Load();
+            vertexProgram.Load();
         }
 
         /// <summary>
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
+            vertexProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/OpenTK/Basic/VertexTransform.cs

 
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
-            this.vertexProgram.Bind();
+            vertexProgram.Bind();
 
-            CgGL.EnableProfile(this.vertexProfile);
+            vertexProfile.Enable();
 
-            this.fragmentProgram.Bind();
+            fragmentProgram.Bind();
 
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProfile.Enable();
 
             /* modelView = rotateMatrix * translateMatrix */
             float[] rotateMatrix = new float[16];
             fragmentProgram.UpdateParameters();
             NativeMethods.glutWireCone(1.5, 3.5, 20, 20);
 
-            CgGL.DisableProfile(vertexProfile);
-
-            CgGL.DisableProfile(fragmentProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
 
             this.SwapBuffers();
         }
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             this.vertexParamModelViewProj = vertexProgram.GetNamedParameter("modelViewProj");
 
                     fragmentProfile, /* Profile: latest fragment profile */
                     "main", /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
 
             this.fragmentParamC = fragmentProgram.GetNamedParameter("c");
         }
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
+            vertexProgram.Dispose();
             fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }

ExampleBrowser/Examples/OpenTK/Basic/VertexTwisting.cs

             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
             vertexParam_twisting.Set(myTwisting);
 
-            this.vertexProgram.Bind();
+            vertexProgram.Bind();
+            vertexProfile.Enable();
 
-            CgGL.EnableProfile(this.vertexProfile);
-
-            this.fragmentProgram.Bind();
-
-            CgGL.EnableProfile(this.fragmentProfile);
+            fragmentProgram.Bind();
+            fragmentProfile.Enable();
 
             DrawSubDividedTriangle(5);
 
-            CgGL.DisableProfile(this.vertexProfile);
+            vertexProfile.Disable();
+            fragmentProfile.Disable();
 
-            CgGL.DisableProfile(this.fragmentProfile);
             this.SwapBuffers();
         }
 
             CgGL.SetDebugMode(false);
             this.CgContext.ParameterSettingMode = ParameterSettingMode.Deferred;
 
-            this.vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
-            CgGL.SetOptimalOptions(this.vertexProfile);
+            vertexProfile = CgGL.GetLatestProfile(ProfileClass.Vertex);
+            CgGL.SetOptimalOptions(vertexProfile);
 
-            this.vertexProgram =
+            vertexProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     VertexProgramFileName, /* Name of file containing program */
-                    this.vertexProfile, /* Profile: OpenGL ARB vertex program */
+                    vertexProfile, /* Profile: OpenGL ARB vertex program */
                     VertexProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.vertexProgram.Load();
+            vertexProgram.Load();
 
             vertexParam_twisting = vertexProgram.GetNamedParameter("twisting");
 
-            this.fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
-            CgGL.SetOptimalOptions(this.fragmentProfile);
+            fragmentProfile = CgGL.GetLatestProfile(ProfileClass.Fragment);
+            CgGL.SetOptimalOptions(fragmentProfile);
 
-            this.fragmentProgram =
+            fragmentProgram =
                 this.CgContext.CreateProgramFromFile(
                     ProgramType.Source, /* Program in human-readable form */
                     FragmentProgramFileName, /* Name of file containing program */
-                    this.fragmentProfile, /* Profile: OpenGL ARB vertex program */
+                    fragmentProfile, /* Profile: OpenGL ARB vertex program */
                     FragmentProgramName, /* Entry function name */
                     null); /* No extra compiler options */
-            this.fragmentProgram.Load();
+            fragmentProgram.Load();
         }
 
         /// <summary>
         protected override void OnUnload(EventArgs e)
         {
             base.OnUnload(e);
-            this.vertexProgram.Dispose();
-            this.fragmentProgram.Dispose();
+            vertexProgram.Dispose();
+            fragmentProgram.Dispose();
             this.CgContext.Dispose();
         }
 

ExampleBrowser/Examples/SlimDX/Basic/VertexFragmentProgram.cs

                 Application.DoEvents();
             }
 
-            this.fragmentProgram.Dispose();
-            this.vertexProgram.Dispose();
+            fragmentProgram.Dispose();
+            vertexProgram.Dispose();
             this.CgContext.Dispose();
             foreach (var item in ObjectTable.Objects)
             {