Tobias Bohnen avatar Tobias Bohnen committed c961ca1

* moved GL/DX extensions to separate assemblies

Comments (0)

Files changed (43)

CgNet.OpenTK/CgGL.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    using System;
+    using System.Collections.Generic;
+    using System.ComponentModel;
+    using System.Runtime.InteropServices;
+
+    using OpenTK;
+
+    public static class CgGL
+    {
+        #region Properties
+
+        #region Public Static Properties
+
+        public static IEnumerable<ProfileType> SupportedProfiles
+        {
+            get
+            {
+                foreach (var profile in Cg.SupportedProfiles)
+                {
+                    if (profile.IsSupported())
+                    {
+                        yield return profile;
+                    }
+                }
+            }
+        }
+
+        #endregion Public Static Properties
+
+        #endregion Properties
+
+        #region Methods
+
+        #region Public Static Methods
+
+        public static GlslVersion DetectGLSLVersion()
+        {
+            return NativeMethods.cgGLDetectGLSLVersion();
+        }
+
+        public static void Disable(this ProfileType profile)
+        {
+            NativeMethods.cgGLDisableProfile(profile);
+        }
+
+        public static void Enable(this ProfileType profile)
+        {
+            NativeMethods.cgGLEnableProfile(profile);
+        }
+
+        public static string GetGLSLVersion(GlslVersion version)
+        {
+            return NativeMethods.cgGLGetGLSLVersionString(version);
+        }
+
+        public static GlslVersion GetGLSLVersion(string version)
+        {
+            return NativeMethods.cgGLGetGLSLVersion(version);
+        }
+
+        /// <summary>
+        /// Gets the latest profile for a profile class.
+        /// </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(this ProfileClass profileClass)
+        {
+            return NativeMethods.cgGLGetLatestProfile(profileClass);
+        }
+
+        public static string[] GetOptimalOptions(this ProfileType profile)
+        {
+            return Cg.IntPtrToStringArray(NativeMethods.cgGLGetOptimalOptions(profile));
+        }
+
+        public static bool IsSupported(this ProfileType profile)
+        {
+            return NativeMethods.cgGLIsProfileSupported(profile);
+        }
+
+        public static void SetDebugMode(bool debug)
+        {
+            NativeMethods.cgGLSetDebugMode(debug);
+        }
+
+        public static void SetOptimalOptions(this ProfileType profile)
+        {
+            NativeMethods.cgGLSetOptimalOptions(profile);
+        }
+
+        public static void UnbindProgram(this ProfileType profile)
+        {
+            NativeMethods.cgGLUnbindProgram(profile);
+        }
+
+        #endregion Public Static Methods
+
+        #region Internal Static Methods
+
+        internal static T GetMatrixParameter<T>(IntPtr param, MatrixOrder order)
+            where T : struct
+        {
+            GCHandle handle = GCHandle.Alloc(new T(), GCHandleType.Pinned);
+
+            try
+            {
+                if (typeof(T) == typeof(Matrix4d))
+                {
+                    switch (order)
+                    {
+                        case MatrixOrder.ColumnMajor:
+                            NativeMethods.cgGLGetMatrixParameterdc(param, handle.AddrOfPinnedObject());
+                            break;
+                        case MatrixOrder.RowMajor:
+                            NativeMethods.cgGLGetMatrixParameterdr(param, handle.AddrOfPinnedObject());
+                            break;
+                        default:
+                            throw new InvalidEnumArgumentException("order");
+                    }
+                }
+                else if (typeof(T) == typeof(Matrix4))
+                {
+                    switch (order)
+                    {
+                        case MatrixOrder.ColumnMajor:
+                            NativeMethods.cgGLGetMatrixParameterfc(param, handle.AddrOfPinnedObject());
+                            break;
+                        case MatrixOrder.RowMajor:
+                            NativeMethods.cgGLGetMatrixParameterfr(param, handle.AddrOfPinnedObject());
+                            break;
+                        default:
+                            throw new InvalidEnumArgumentException("order");
+                    }
+                }
+                else
+                {
+                    throw new ArgumentException();
+                }
+
+                return (T)handle.Target;
+            }
+            finally
+            {
+                handle.Free();
+            }
+        }
+
+        internal static T[] GetMatrixParameterArray<T>(IntPtr param, int offset, int nelements, MatrixOrder order)
+            where T : struct
+        {
+            var retValue = new T[nelements];
+            GCHandle g = GCHandle.Alloc(retValue, GCHandleType.Pinned);
+
+            try
+            {
+                if (typeof(T) == typeof(Matrix4))
+                {
+                    switch (order)
+                    {
+                        case MatrixOrder.ColumnMajor:
+                            NativeMethods.cgGLGetMatrixParameterArrayfc(param, offset, nelements, g.AddrOfPinnedObject());
+                            break;
+                        case MatrixOrder.RowMajor:
+                            NativeMethods.cgGLGetMatrixParameterArrayfr(param, offset, nelements, g.AddrOfPinnedObject());
+                            break;
+                        default:
+                            throw new InvalidEnumArgumentException("order");
+                    }
+                }
+                else if (typeof(T) == typeof(Matrix4d))
+                {
+                    switch (order)
+                    {
+                        case MatrixOrder.ColumnMajor:
+                            NativeMethods.cgGLGetMatrixParameterArraydc(param, offset, nelements, g.AddrOfPinnedObject());
+                            break;
+                        case MatrixOrder.RowMajor:
+                            NativeMethods.cgGLGetMatrixParameterArraydr(param, offset, nelements, g.AddrOfPinnedObject());
+                            break;
+                        default:
+                            throw new InvalidEnumArgumentException("order");
+                    }
+                }
+                else
+                {
+                    throw new ArgumentException();
+                }
+
+                return retValue;
+            }
+            finally
+            {
+                g.Free();
+            }
+        }
+
+        internal static void SetMatrixParameter(IntPtr param, Matrix4d matrix, MatrixOrder order)
+        {
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGLSetMatrixParameterdc(param, ref matrix);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGLSetMatrixParameterdr(param, ref matrix);
+                    break;
+                default:
+                    throw new ArgumentOutOfRangeException("order");
+            }
+        }
+
+        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4d[] matrices, MatrixOrder order)
+        {
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGLSetMatrixParameterArraydc(param, offset, nelements, matrices);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGLSetMatrixParameterArraydr(param, offset, nelements, matrices);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
+            }
+        }
+
+        internal static void SetMatrixParameterArray(IntPtr param, int offset, int nelements, Matrix4[] matrices, MatrixOrder order)
+        {
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGLSetMatrixParameterArrayfc(param, offset, nelements, matrices);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGLSetMatrixParameterArrayfr(param, offset, nelements, matrices);
+                    break;
+                default:
+                    throw new InvalidEnumArgumentException("order");
+            }
+        }
+
+        #endregion Internal Static Methods
+
+        #endregion Methods
+    }
+}

CgNet.OpenTK/CgGLBuffer.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    public static class CgGLBuffer
+    {
+        #region Methods
+
+        #region Public Static Methods
+
+        public static int GetBufferObject(this Buffer buffer)
+        {
+            return NativeMethods.cgGLGetBufferObject(buffer.Handle);
+        }
+
+        #endregion Public Static Methods
+
+        #endregion Methods
+    }
+}

CgNet.OpenTK/CgGLContext.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    using System;
+
+    using Buffer = CgNet.Buffer;
+
+    using OpenTK.Graphics.OpenGL;
+
+    public static class CgGLContext
+    {
+        #region Methods
+
+        #region Public Static Methods
+
+        public static Buffer CreateBuffer(this Context context, int size, IntPtr data, BufferUsageHint bufferUsage)
+        {
+            return new Buffer(NativeMethods.cgGLCreateBuffer(context.Handle, size, data, bufferUsage));
+        }
+
+        public static Buffer CreateBufferFromObject(this Context context, OpenTK.Graphics.OpenGL.BufferUsageHint flags, bool manageObject)
+        {
+            var retValue = new Buffer(NativeMethods.cgGLCreateBufferFromObject(context.Handle, flags, manageObject));
+            retValue.OwnsHandle = !manageObject;
+            return retValue;
+        }
+
+        public static GlslVersion GetGlslVersion(this Context context)
+        {
+            return NativeMethods.cgGLGetContextGLSLVersion(context.Handle);
+        }
+
+        public static bool GetManageTextureParameters(this Context context)
+        {
+            return NativeMethods.cgGLGetManageTextureParameters(context.Handle);
+        }
+
+        public static string[] GetOptimalOptions(this Context context, ProfileType profile)
+        {
+            return Cg.IntPtrToStringArray(NativeMethods.cgGLGetContextOptimalOptions(context.Handle, profile));
+        }
+
+        public static void RegisterStates(this Context context)
+        {
+            NativeMethods.cgGLRegisterStates(context.Handle);
+        }
+
+        public static void SetGlslVersion(this Context context, GlslVersion version)
+        {
+            NativeMethods.cgGLSetContextGLSLVersion(context.Handle, version);
+        }
+
+        public static void SetManageTextureParameters(this Context context, bool flag)
+        {
+            NativeMethods.cgGLSetManageTextureParameters(context.Handle, flag);
+        }
+
+        public static void SetOptimalOptions(this Context context, ProfileType profile)
+        {
+            NativeMethods.cgGLSetContextOptimalOptions(context.Handle, profile);
+        }
+
+        #endregion Public Static Methods
+
+        #endregion Methods
+    }
+}

CgNet.OpenTK/CgGLEnums.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    #region Enumerations
+
+    public enum CgGLAll
+    {
+        MatrixIdentity = 0,
+        MatrixTranspose = 1,
+        MatrixInverse = 2,
+        MatrixInverseTranspose = 3,
+        ModelviewMatrix = 4,
+        ProjectionMatrix = 5,
+        TextureMatrix = 6,
+        ModelviewProjectionMatrix = 7,
+        Vertex = 8,
+        Fragment = 9,
+        Geometry = 10,
+        TessellationControl = 11,
+        TessellationEvaluation = 12
+    }
+
+    public enum GlslVersion
+    {
+        Default = 0,
+        Glsl_100     = 1,
+        Glsl_110     = 2,
+        Glsl_120     = 3
+    }
+
+    public enum MatrixTransform
+    {
+        MatrixIdentity = 0,
+        MatrixTranspose = 1,
+        MatrixInverse = 2,
+        MatrixInverseTranspose = 3,
+    }
+
+    public enum MatrixType
+    {
+        ModelviewMatrix = 4,
+        ProjectionMatrix = 5,
+        TextureMatrix = 6,
+        ModelviewProjectionMatrix = 7,
+    }
+
+    public enum ProfileClass
+    {
+        Vertex = 8,
+        Fragment = 9,
+        Geometry = 10,
+        TessellationControl = 11,
+        TessellationEvaluation = 12
+    }
+
+    #endregion Enumerations
+}

CgNet.OpenTK/CgGLParameter.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    using System;
+    using System.Runtime.InteropServices;
+
+    using OpenTK;
+    using OpenTK.Graphics.OpenGL;
+
+    public static class CgGLParameter
+    {
+        #region Methods
+
+        #region Public Static Methods
+
+        public static void DisableClientState(this Parameter param)
+        {
+            NativeMethods.cgGLDisableClientState(param.Handle);
+        }
+
+        // TODO: TextureParameter
+        public static void DisableTexture(this Parameter param)
+        {
+            NativeMethods.cgGLDisableTextureParameter(param.Handle);
+        }
+
+        public static void EnableClientState(this Parameter param)
+        {
+            NativeMethods.cgGLEnableClientState(param.Handle);
+        }
+
+        // TODO: TextureParameter
+        public static void EnableTexture(this Parameter param)
+        {
+            NativeMethods.cgGLEnableTextureParameter(param.Handle);
+        }
+
+        public static T Get<T>(this Parameter param)
+            where T : struct
+        {
+            IntPtr param1 = param.Handle;
+            GCHandle handle = GCHandle.Alloc(new T(), GCHandleType.Pinned);
+            try
+            {
+                if (typeof(T) == typeof(float))
+                {
+                    NativeMethods.cgGLGetParameter1f(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(double))
+                {
+                    NativeMethods.cgGLGetParameter1d(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector2))
+                {
+                    NativeMethods.cgGLGetParameter2f(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector2d))
+                {
+                    NativeMethods.cgGLGetParameter2d(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector3))
+                {
+                    NativeMethods.cgGLGetParameter3f(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector3d))
+                {
+                    NativeMethods.cgGLGetParameter3d(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector4))
+                {
+                    NativeMethods.cgGLGetParameter4f(param1, handle.AddrOfPinnedObject());
+                }
+                else if (typeof(T) == typeof(Vector4d))
+                {
+                    NativeMethods.cgGLGetParameter4d(param1, handle.AddrOfPinnedObject());
+                }
+                else
+                {
+                    throw new ArgumentException();
+                }
+
+                return (T)handle.Target;
+            }
+            finally
+            {
+                handle.Free();
+            }
+        }
+
+        public static void Get(this Parameter param, float[] values)
+        {
+            IntPtr param1 = param.Handle;
+            GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned);
+            try
+            {
+                switch (values.Length)
+                {
+                    case 1:
+                        NativeMethods.cgGLGetParameter1f(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 2:
+                        NativeMethods.cgGLGetParameter2f(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 3:
+                        NativeMethods.cgGLGetParameter3f(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 4:
+                        NativeMethods.cgGLGetParameter4f(param1, handle.AddrOfPinnedObject());
+                        break;
+                }
+            }
+            finally
+            {
+                handle.Free();
+            }
+        }
+
+        public static void Get(this Parameter param, double[] values)
+        {
+            IntPtr param1 = param.Handle;
+            GCHandle handle = GCHandle.Alloc(values);
+            try
+            {
+                switch (values.Length)
+                {
+                    case 1:
+                        NativeMethods.cgGLGetParameter1d(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 2:
+                        NativeMethods.cgGLGetParameter2d(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 3:
+                        NativeMethods.cgGLGetParameter3d(param1, handle.AddrOfPinnedObject());
+                        break;
+                    case 4:
+                        NativeMethods.cgGLGetParameter4d(param1, handle.AddrOfPinnedObject());
+                        break;
+                }
+            }
+            finally
+            {
+                handle.Free();
+            }
+        }
+
+        public static void GetArray(this Parameter param, int offset, int nelements, float[] values)
+        {
+            IntPtr param1 = param.Handle;
+            GCHandle g = GCHandle.Alloc(values, GCHandleType.Pinned);
+            try
+            {
+                switch (values.Length / nelements)
+                {
+                    case 1:
+                        NativeMethods.cgGLGetParameterArray1f(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 2:
+                        NativeMethods.cgGLGetParameterArray2f(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 3:
+                        NativeMethods.cgGLGetParameterArray3f(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 4:
+                        NativeMethods.cgGLGetParameterArray4f(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                }
+            }
+            finally
+            {
+                g.Free();
+            }
+        }
+
+        public static void GetArray(this Parameter param, int offset, int nelements, double[] values)
+        {
+            IntPtr param1 = param.Handle;
+            GCHandle g = GCHandle.Alloc(values, GCHandleType.Pinned);
+            try
+            {
+                switch (values.Length / nelements)
+                {
+                    case 1:
+                        NativeMethods.cgGLGetParameterArray1d(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 2:
+                        NativeMethods.cgGLGetParameterArray2d(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 3:
+                        NativeMethods.cgGLGetParameterArray3d(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                    case 4:
+                        NativeMethods.cgGLGetParameterArray4d(param1, offset, nelements, g.AddrOfPinnedObject());
+                        break;
+                }
+            }
+            finally
+            {
+                g.Free();
+            }
+        }
+
+        public static void GetMatrix(this Parameter param, out Matrix4 value)
+        {
+            value = CgGL.GetMatrixParameter<Matrix4>(param.Handle, Cg.DefaultMatrixOrder);
+        }
+
+        public static void GetMatrix(this Parameter param, out Matrix4d value)
+        {
+            value = CgGL.GetMatrixParameter<Matrix4d>(param.Handle, Cg.DefaultMatrixOrder);
+        }
+
+        public static T GetMatrix<T>(this Parameter param)
+            where T : struct
+        {
+            return CgGL.GetMatrixParameter<T>(param.Handle, Cg.DefaultMatrixOrder);
+        }
+
+        public static T GetMatrix<T>(this Parameter param, MatrixOrder order)
+            where T : struct
+        {
+            return CgGL.GetMatrixParameter<T>(param.Handle, order);
+        }
+
+        public static void GetMatrixArray(this Parameter param, int offset, int nelements, out Matrix4[] values)
+        {
+            values = CgGL.GetMatrixParameterArray<Matrix4>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
+        }
+
+        public static void GetMatrixArray(this Parameter param, int offset, int nelements, out Matrix4d[] values)
+        {
+            values = CgGL.GetMatrixParameterArray<Matrix4d>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
+        }
+
+        public static T[] GetMatrixArray<T>(this Parameter param, int offset, int nelements)
+            where T : struct
+        {
+            return CgGL.GetMatrixParameterArray<T>(param.Handle, offset, nelements, Cg.DefaultMatrixOrder);
+        }
+
+        public static T[] GetMatrixArray<T>(this Parameter param, int offset, int nelements, MatrixOrder order)
+            where T : struct
+        {
+            return CgGL.GetMatrixParameterArray<T>(param.Handle, offset, nelements, order);
+        }
+
+        public static int GetTextureEnum(this Parameter param)
+        {
+            return NativeMethods.cgGLGetTextureEnum(param.Handle);
+        }
+
+        public static int GetTextureParameter(this Parameter param)
+        {
+            return NativeMethods.cgGLGetTextureParameter(param.Handle);
+        }
+
+        public static void Set(this Parameter param, double x)
+        {
+            NativeMethods.cgGLSetParameter1d(param.Handle, x);
+        }
+
+        public static void Set(this Parameter param, double[] v)
+        {
+            IntPtr param1 = param.Handle;
+            switch (v.Length)
+            {
+                case 1:
+                    NativeMethods.cgGLSetParameter1dv(param1, v);
+                    break;
+                case 2:
+                    NativeMethods.cgGLSetParameter2dv(param1, v);
+                    break;
+                case 3:
+                    NativeMethods.cgGLSetParameter3dv(param1, v);
+                    break;
+                case 4:
+                    NativeMethods.cgGLSetParameter4dv(param1, v);
+                    break;
+                default:
+                    throw new ArgumentException();
+            }
+        }
+
+        public static void Set(this Parameter param, float[] v)
+        {
+            IntPtr param1 = param.Handle;
+            switch (v.Length)
+            {
+                case 1:
+                    NativeMethods.cgGLSetParameter1fv(param1, v);
+                    break;
+                case 2:
+                    NativeMethods.cgGLSetParameter2fv(param1, v);
+                    break;
+                case 3:
+                    NativeMethods.cgGLSetParameter3fv(param1, v);
+                    break;
+                case 4:
+                    NativeMethods.cgGLSetParameter4fv(param1, v);
+                    break;
+                default:
+                    throw new ArgumentException();
+            }
+        }
+
+        public static void Set(this Parameter param, float x)
+        {
+            NativeMethods.cgGLSetParameter1f(param.Handle, x);
+        }
+
+        public static void Set(this Parameter param, double x, double y)
+        {
+            NativeMethods.cgGLSetParameter2d(param.Handle, x, y);
+        }
+
+        public static void Set(this Parameter param, float x, float y)
+        {
+            NativeMethods.cgGLSetParameter2f(param.Handle, x, y);
+        }
+
+        public static void Set(this Parameter param, double x, double y, double z)
+        {
+            NativeMethods.cgGLSetParameter3d(param.Handle, x, y, z);
+        }
+
+        public static void Set(this Parameter param, float x, float y, float z)
+        {
+            NativeMethods.cgGLSetParameter3f(param.Handle, x, y, z);
+        }
+
+        public static void Set(this Parameter param, double x, double y, double z, double w)
+        {
+            NativeMethods.cgGLSetParameter4d(param.Handle, x, y, z, w);
+        }
+
+        public static void Set(this Parameter param, float x, float y, float z, float w)
+        {
+            NativeMethods.cgGLSetParameter4f(param.Handle, x, y, z, w);
+        }
+
+        public static void Set(this Parameter param, Vector2 v)
+        {
+            Vector2 v1 = v;
+            NativeMethods.cgGLSetParameter2f(param.Handle, v1.X, v1.Y);
+        }
+
+        public static void Set(this Parameter param, Vector2d v)
+        {
+            Vector2d v1 = v;
+            NativeMethods.cgGLSetParameter2d(param.Handle, v1.X, v1.Y);
+        }
+
+        public static void Set(this Parameter param, Vector3 v)
+        {
+            Vector3 v1 = v;
+            NativeMethods.cgGLSetParameter3f(param.Handle, v1.X, v1.Y, v1.Z);
+        }
+
+        public static void Set(this Parameter param, Vector3d v)
+        {
+            Vector3d v1 = v;
+            NativeMethods.cgGLSetParameter3d(param.Handle, v1.X, v1.Y, v1.Z);
+        }
+
+        public static void Set(this Parameter param, Vector4 v)
+        {
+            Vector4 v1 = v;
+            NativeMethods.cgGLSetParameter4f(param.Handle, v1.X, v1.Y, v1.Z, v1.W);
+        }
+
+        public static void Set(this Parameter param, Vector4d v)
+        {
+            Vector4d v1 = v;
+            NativeMethods.cgGLSetParameter4d(param.Handle, v1.X, v1.Y, v1.Z, v1.W);
+        }
+
+        public static void SetArray(this Parameter param, int offset, int nelements, float[] values)
+        {
+            IntPtr param1 = param.Handle;
+            switch (values.Length / nelements)
+            {
+                case 1:
+                    NativeMethods.cgGLSetParameterArray1f(param1, offset, nelements, values);
+                    break;
+                case 2:
+                    NativeMethods.cgGLSetParameterArray2f(param1, offset, nelements, values);
+                    break;
+                case 3:
+                    NativeMethods.cgGLSetParameterArray3f(param1, offset, nelements, values);
+                    break;
+                case 4:
+                    NativeMethods.cgGLSetParameterArray4f(param1, offset, nelements, values);
+                    break;
+            }
+        }
+
+        public static void SetArray(this Parameter param, int offset, int nelements, double[] values)
+        {
+            IntPtr param1 = param.Handle;
+            switch (values.Length / nelements)
+            {
+                case 1:
+                    NativeMethods.cgGLSetParameterArray1d(param1, offset, nelements, values);
+                    break;
+                case 2:
+                    NativeMethods.cgGLSetParameterArray2d(param1, offset, nelements, values);
+                    break;
+                case 3:
+                    NativeMethods.cgGLSetParameterArray3d(param1, offset, nelements, values);
+                    break;
+                case 4:
+                    NativeMethods.cgGLSetParameterArray4d(param1, offset, nelements, values);
+                    break;
+            }
+        }
+
+        public static void SetMatrix(this Parameter param, Matrix4 matrix)
+        {
+            SetMatrix(param, matrix, Cg.DefaultMatrixOrder);
+        }
+
+        public static void SetMatrix(this Parameter param, Matrix4 matrix, MatrixOrder order)
+        {
+            switch (order)
+            {
+                case MatrixOrder.ColumnMajor:
+                    NativeMethods.cgGLSetMatrixParameterfc(param.Handle, ref matrix);
+                    break;
+                case MatrixOrder.RowMajor:
+                    NativeMethods.cgGLSetMatrixParameterfr(param.Handle, ref matrix);
+                    break;
+                default:
+                    throw new ArgumentOutOfRangeException("order");
+            }
+        }
+
+        public static void SetMatrix(this Parameter param, Matrix4d matrix)
+        {
+            CgGL.SetMatrixParameter(param.Handle, matrix, Cg.DefaultMatrixOrder);
+        }
+
+        public static void SetMatrix(this Parameter param, Matrix4d matrix, MatrixOrder order)
+        {
+            CgGL.SetMatrixParameter(param.Handle, matrix, order);
+        }
+
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4d[] matrices)
+        {
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultMatrixOrder);
+        }
+
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4[] matrices)
+        {
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, Cg.DefaultMatrixOrder);
+        }
+
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4d[] matrices, MatrixOrder order)
+        {
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, order);
+        }
+
+        public static void SetMatrixArray(this Parameter param, int offset, int nelements, Matrix4[] matrices, MatrixOrder order)
+        {
+            CgGL.SetMatrixParameterArray(param.Handle, offset, nelements, matrices, order);
+        }
+
+        public static void SetPointer(this Parameter param, int fsize, DataType type, int stride, IntPtr pointer)
+        {
+            NativeMethods.cgGLSetParameterPointer(param.Handle, fsize, type, stride, pointer);
+        }
+
+        public static void SetStateMatrix(this Parameter param, MatrixType matrix, MatrixTransform transform)
+        {
+            NativeMethods.cgGLSetStateMatrixParameter(param.Handle, matrix, transform);
+        }
+
+        // TODO: TextureParameter
+        public static void SetTexture(this Parameter param, int texobj)
+        {
+            NativeMethods.cgGLSetTextureParameter(param.Handle, texobj);
+        }
+
+        public static void SetupSampler(this Parameter param, int texobj)
+        {
+            NativeMethods.cgGLSetupSampler(param.Handle, texobj);
+        }
+
+        #endregion Public Static Methods
+
+        #endregion Methods
+    }
+}

CgNet.OpenTK/CgGLProgram.cs

+ďťż/*
+ CgNet v1.0
+ Copyright (c) 2010 Tobias Bohnen
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ software and associated documentation files (the "Software"), to deal in the Software
+ without restriction, including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+ to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or
+ substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    public static class CgGLProgram
+    {
+        #region Methods
+
+        #region Public Static Methods
+
+        public static void Bind(this Program program)
+        {
+            NativeMethods.cgGLBindProgram(program.Handle);
+        }
+
+        public static void DisableProgramProfiles(this Program program)
+        {
+            NativeMethods.cgGLDisableProgramProfiles(program.Handle);
+        }
+
+        public static void EnableProgramProfiles(this Program program)
+        {
+            NativeMethods.cgGLEnableProgramProfiles(program.Handle);
+        }
+
+        public static int GetProgramID(this Program program)
+        {
+            return NativeMethods.cgGLGetProgramID(program.Handle);
+        }
+
+        public static bool IsLoaded(this Program program)
+        {
+            return NativeMethods.cgGLIsProgramLoaded(program.Handle);
+        }
+
+        public static void Load(this Program program)
+        {
+            NativeMethods.cgGLLoadProgram(program.Handle);
+        }
+
+        public static void Unload(this Program program)
+        {
+            NativeMethods.cgGLUnloadProgram(program.Handle);
+        }
+
+        #endregion Public Static Methods
+
+        #endregion Methods
+    }
+}

CgNet.OpenTK/CgNet.OpenTK.csproj

+ďťż<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+  <PropertyGroup>
+    <ProjectGuid>{BA459981-3292-4716-954D-E21BD06A8B0B}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <RootNamespace>CgNet.GL</RootNamespace>
+    <AssemblyName>CgNet.OpenTK</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <SignAssembly>False</SignAssembly>
+    <DelaySign>False</DelaySign>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+    <NoStdLib>False</NoStdLib>
+    <WarningLevel>4</WarningLevel>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <AssemblyOriginatorKeyFile>..\CgNet.snk</AssemblyOriginatorKeyFile>
+    <AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <RegisterForComInterop>False</RegisterForComInterop>
+    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
+    <BaseAddress>4194304</BaseAddress>
+    <FileAlignment>4096</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <OutputPath>bin\Debug\</OutputPath>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>Full</DebugType>
+    <Optimize>False</Optimize>
+    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <DebugSymbols>False</DebugSymbols>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <DefineConstants>TRACE</DefineConstants>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="OpenTK">
+      <HintPath>..\..\..\..\..\SDKs\OpenTK\1.0\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="CgGL.cs" />
+    <Compile Include="CgGLBuffer.cs" />
+    <Compile Include="CgGLContext.cs" />
+    <Compile Include="CgGLEnums.cs" />
+    <Compile Include="CgGLParameter.cs" />
+    <Compile Include="CgGLProgram.cs" />
+    <Compile Include="NativeMethods.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\CgNet\CgNet.csproj">
+      <Project>{8F858C68-C03F-4394-8FDE-B6BA2B9EBA99}</Project>
+      <Name>CgNet</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
+</Project>

CgNet.OpenTK/NativeMethods.cs

+/*
+MIT License
+Copyright Š2003-2006 Tao Framework Team
+http://www.taoframework.com
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+ */
+namespace CgNet.GL
+{
+    using System;
+    using System.Runtime.InteropServices;
+    using System.Security;
+
+    using OpenTK;
+    using OpenTK.Graphics.OpenGL;
+
+    internal static class NativeMethods
+    {
+        #region Fields
+
+        private const string CgGLNativeLibrary = "cgGL.dll";
+        private const CallingConvention Convention = CallingConvention.Cdecl;
+
+        #endregion Fields
+
+        #region Methods
+
+        #region Public Static Methods
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern IntPtr cgGLCreateBufferFromObject(IntPtr handle, OpenTK.Graphics.OpenGL.BufferUsageHint flags, [MarshalAs(UnmanagedType.Bool)] bool manageObject);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern GlslVersion cgGLDetectGLSLVersion();
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern GlslVersion cgGLGetContextGLSLVersion(IntPtr handle);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern IntPtr cgGLGetContextOptimalOptions(IntPtr handle, ProfileType profile);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern void cgGLSetContextGLSLVersion(IntPtr handle, GlslVersion version);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern void cgGLSetContextOptimalOptions(IntPtr handle, ProfileType profile);
+
+        #endregion Public Static Methods
+
+        #region Internal Static Methods
+
+        /// <summary>
+        /// Bind the program to the current OpenGL API state.
+        /// </summary>
+        /// <param name="program">
+        /// Handle to the program to bind.
+        /// </param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLBindProgram(IntPtr program);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern IntPtr cgGLCreateBuffer(IntPtr context, int size, IntPtr data, OpenTK.Graphics.OpenGL.BufferUsageHint bufferUsage);
+
+        /// <summary>
+        ///     Disables a vertex attribute in OpenGL state.
+        /// </summary>
+        /// <param name="param">Parameter to disable.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLDisableClientState(IntPtr param);
+
+        /// <summary>
+        /// Disables the selected profile.
+        /// </summary>
+        /// <param name="profile">
+        /// Profile to disable.
+        /// </param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLDisableProfile(ProfileType profile);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLDisableProgramProfiles(IntPtr program);
+
+        /// <summary>
+        /// Disables the texture unit associated with the given texture parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLDisableTextureParameter(IntPtr param);
+
+        /// <summary>
+        ///     Enables a vertex attribute in OpenGL state.
+        /// </summary>
+        /// <param name="param">Parameter to enable.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLEnableClientState(IntPtr param);
+
+        /// <summary>
+        /// Enables the selected profile.
+        /// </summary>
+        /// <param name="profile">
+        /// Profile to enable.
+        /// </param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLEnableProfile(ProfileType profile);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLEnableProgramProfiles(IntPtr program);
+
+        /// <summary>
+        /// Enables (binds) the texture unit associated with the given texture parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLEnableTextureParameter(IntPtr param);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern int cgGLGetBufferObject(IntPtr buffer);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern GlslVersion cgGLGetGLSLVersion(string version);
+
+        //const char * cgGLGetGLSLVersionString( CGGLglslversion version );
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern string cgGLGetGLSLVersionString(GlslVersion version);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern ProfileType cgGLGetLatestProfile(ProfileClass profileType);
+
+        /// <summary>
+        /// Retreives the manage texture parameters flag from a context
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        [return: MarshalAs(UnmanagedType.Bool)]
+        internal static extern bool cgGLGetManageTextureParameters(IntPtr context);
+
+        /// <summary>
+        /// Gets an array matrix parameters (double) in column order.
+        /// </summary>
+        /// <param name="param">Parameter to get data from.</param>
+        /// <param name="offset">An offset into the array parameter to start getting from.</param>
+        /// <param name="nelements">The number of elements to get. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values retreived from parameter.. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterArraydc(IntPtr param, int offset, int nelements, IntPtr matrices);
+
+        /// <summary>
+        /// Gets an array matrix parameters (double) in row order.
+        /// </summary>
+        /// <param name="param">Parameter to get data from.</param>
+        /// <param name="offset">An offset into the array parameter to start getting from.</param>
+        /// <param name="nelements">The number of elements to get. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values retreived from parameter.. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterArraydr(IntPtr param, int offset, int nelements, IntPtr matrices);
+
+        /// <summary>
+        /// Gets an array matrix parameters (float) in column order.
+        /// </summary>
+        /// <param name="param">Parameter to get data from.</param>
+        /// <param name="offset">An offset into the array parameter to start getting from.</param>
+        /// <param name="nelements">The number of elements to get. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values retreived from parameter.. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterArrayfc(IntPtr param, int offset, int nelements, IntPtr matrices);
+
+        /// <summary>
+        /// Gets an array matrix parameters (float) in row order.
+        /// </summary>
+        /// <param name="param">Parameter to get data from.</param>
+        /// <param name="offset">An offset into the array parameter to start getting from.</param>
+        /// <param name="nelements">The number of elements to get. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values retreived from parameter.. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterArrayfr(IntPtr param, int offset, int nelements, IntPtr matrices);
+
+        /// <summary>
+        /// Gets the value of matrix parameters in column order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterdc(IntPtr param, IntPtr matrix);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterdr(IntPtr param, IntPtr matrix);
+
+        /// <summary>
+        /// Gets the value of matrix parameters in column order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterfc(IntPtr param, IntPtr matrix);
+
+        /// <summary>
+        /// Gets the value of matrix parameters in row order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetMatrixParameterfr(IntPtr param, IntPtr matrix);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention, CharSet = CharSet.Ansi)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern IntPtr cgGLGetOptimalOptions(ProfileType profile);
+
+        /// <summary>
+        /// Gets the double value to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter1d(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float value to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter1f(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter2d(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter2f(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter3d(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter3f(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter4d(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameter4f(IntPtr param, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray1d(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray1f(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray2d(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray2f(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray3d(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray3f(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the double values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray4d(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Gets the float values from the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to get values from.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to get.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLGetParameterArray4f(IntPtr param, int offset, int nelements, [Out] IntPtr values);
+
+        /// <summary>
+        /// Returns the program's ID.
+        /// </summary>
+        /// <param name="program">
+        /// Handle to the program.
+        /// </param>
+        /// <returns>
+        /// Program's ID.
+        /// </returns>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern int cgGLGetProgramID(IntPtr program);
+
+        /// <summary>
+        /// Retreives the OpenGL enumeration for the texture unit associated with the texture parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// It can be one of the GL_TEXTURE#_ARB if valid.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern int cgGLGetTextureEnum(IntPtr param);
+
+        /// <summary>
+        /// Retreives the value of a texture parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern int cgGLGetTextureParameter(IntPtr param);
+
+        /// <summary>
+        /// Checks if the profile is supported.
+        /// </summary>
+        /// <param name="profile">
+        /// The profile to check the support of.
+        /// </param>
+        /// <returns>
+        /// Returns true if the profile is supported.
+        /// </returns>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern bool cgGLIsProfileSupported(ProfileType profile);
+
+        /// <summary>
+        /// Returns true if the specified program is loaded.
+        /// </summary>
+        /// <param name="program">
+        /// Handle to the program.
+        /// </param>
+        /// <returns>
+        /// True if the specified program is loaded.
+        /// </returns>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern bool cgGLIsProgramLoaded(IntPtr program);
+
+        /// <summary>
+        /// Loads program to OpenGL pipeline
+        /// </summary>
+        /// <param name="program">
+        /// Handle to the program to load.
+        /// </param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLLoadProgram(IntPtr program);
+
+        /// <summary>
+        ///
+        /// </summary>
+        // CGGLDLL_API void cgGLRegisterStates(CGcontext);
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLRegisterStates(IntPtr context);
+
+        //CGGL_API void CGGLENTRY cgGLSetDebugMode( CGbool debug );
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetDebugMode([MarshalAs(UnmanagedType.Bool)] bool debug);
+
+        /// <summary>
+        /// Enables or disables the automatic texture management for the given rendering context.
+        /// <remarks>
+        /// Use CG_TRUE or CG_FALSE to enable/disable automatic texture management.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetManageTextureParameters(IntPtr context, bool flag);
+
+        /// <summary>
+        /// Sets an array matrix parameters (double) in column order.
+        /// </summary>
+        /// <param name="param">Parameter to be set.</param>
+        /// <param name="offset">An offset into the array parameter to start setting from.</param>
+        /// <param name="nelements">The number of elements to set. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values to set the parameter to. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterArraydc(IntPtr param, int offset, int nelements, [In] Matrix4d[] matrices);
+
+        /// <summary>
+        /// Sets an array matrix parameters (double) in row order.
+        /// </summary>
+        /// <param name="param">Parameter to be set.</param>
+        /// <param name="offset">An offset into the array parameter to start setting from.</param>
+        /// <param name="nelements">The number of elements to set. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values to set the parameter to. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterArraydr(IntPtr param, int offset, int nelements, [In] Matrix4d[] matrices);
+
+        /// <summary>
+        /// Sets an array matrix parameters (float) in column order.
+        /// </summary>
+        /// <param name="param">Parameter to be set.</param>
+        /// <param name="offset">An offset into the array parameter to start setting from.</param>
+        /// <param name="nelements">The number of elements to set. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values to set the parameter to. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterArrayfc(IntPtr param, int offset, int nelements, [In] Matrix4[] matrices);
+
+        /// <summary>
+        /// Sets an array matrix parameters (float) in row order.
+        /// </summary>
+        /// <param name="param">Parameter to be set.</param>
+        /// <param name="offset">An offset into the array parameter to start setting from.</param>
+        /// <param name="nelements">The number of elements to set. A value of 0 will default to the number of elements in the array minus the offset value.</param>
+        /// <param name="matrices">The array of values to set the parameter to. This must be a contiguous set of values that total nelements times the number of elements in the matrix.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterArrayfr(IntPtr param, int offset, int nelements, [In] Matrix4[] matrices);
+
+        /// <summary>
+        /// Sets the value of matrix parameters in column  order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterdc(IntPtr param, ref Matrix4d matrix);
+
+        /// <summary>
+        /// Sets the value of matrix parameters in row order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterdr(IntPtr param, ref Matrix4d matrix);
+
+        /// <summary>
+        /// Sets the value of matrix parameters in column  order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterfc(IntPtr param, ref Matrix4 matrix);
+
+        /// <summary>
+        /// Sets the value of matrix parameters in row order.
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetMatrixParameterfr(IntPtr param, ref Matrix4 matrix);
+
+        /// <summary>
+        /// Sets the best compiler options available by card, driver and selected profile.
+        /// </summary>
+        /// <param name="profile">
+        /// Profile.
+        /// </param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetOptimalOptions(ProfileType profile);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter1d(IntPtr param, double x);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter1dv(IntPtr param, [In] double[] values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter1f(IntPtr param, float x);
+
+        /// <summary>
+        /// Sets the float value to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter1fv(IntPtr param, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float value to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter1fv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2d(IntPtr param, double x, double y);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2dv(IntPtr param, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2dv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2f(IntPtr param, float x, float y);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2fv(IntPtr param, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter2fv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3d(IntPtr param, double x, double y, double z);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3dv(IntPtr param, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3dv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3f(IntPtr param, float x, float y, float z);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3fv(IntPtr param, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter3fv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4d(IntPtr param, double x, double y, double z, double w);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4dv(IntPtr param, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4dv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4f(IntPtr param, float x, float y, float z, float w);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4fv(IntPtr param, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specified parameter.
+        /// <remarks>
+        /// Use cgGetNamedParameter to obtain the valid pointer to param.
+        /// </remarks>
+        /// </summary>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameter4fv(IntPtr param, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray1d(IntPtr param, int offset, int nelements, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray1d(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray1f(IntPtr param, int offset, int nelements, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray1f(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray2d(IntPtr param, int offset, int nelements, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray2d(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray2f(IntPtr param, int offset, int nelements, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray2f(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray3d(IntPtr param, int offset, int nelements, [In] double[] values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray3d(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray3f(IntPtr param, int offset, int nelements, [In] float[] values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray3f(IntPtr param, int offset, int nelements, [In] IntPtr values);
+
+        /// <summary>
+        /// Sets the double values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray4d(IntPtr param, int offset, int nelements, [In] Matrix4d[] values);
+
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray4d(IntPtr param, int offset, int nelements, [In] double[] values);
+
+        /// <summary>
+        /// Sets the float values to the specific parameter.
+        /// </summary>
+        /// <param name="param">Parameter to set values to.</param>
+        /// <param name="offset">Offset into an array</param>
+        /// <param name="nelements">Number of values to set.</param>
+        /// <param name="values">Array of values.</param>
+        [DllImport(CgGLNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        internal static extern void cgGLSetParameterArray4f(IntPtr param, int offset, int nelements, [In] Matrix4[] values);
+
+        /// <summary>