diff --git a/src/Form1.Designer.cs b/src/Form1.Designer.cs index dae38d5..2cd4e3e 100644 --- a/src/Form1.Designer.cs +++ b/src/Form1.Designer.cs @@ -23,35 +23,34 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.canvas1 = new JuicyGraphics.canvas(); - ((System.ComponentModel.ISupportInitialize)(this.canvas1)).BeginInit(); + this.canvas2 = new JuicyGraphics.canvas(); + ((System.ComponentModel.ISupportInitialize)(this.canvas2)).BeginInit(); this.SuspendLayout(); // - // canvas1 + // canvas2 // - this.canvas1.Dock = System.Windows.Forms.DockStyle.Fill; - this.canvas1.Location = new System.Drawing.Point(0, 0); - this.canvas1.Name = "canvas1"; - this.canvas1.Size = new System.Drawing.Size(704, 521); - this.canvas1.TabIndex = 0; - this.canvas1.Text = "canvas1"; + this.canvas2.Dock = System.Windows.Forms.DockStyle.Fill; + this.canvas2.Location = new System.Drawing.Point(0, 0); + this.canvas2.Name = "canvas2"; + this.canvas2.Size = new System.Drawing.Size(704, 521); + this.canvas2.TabIndex = 3; + this.canvas2.Text = "canvas2"; // // mainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(704, 521); - this.Controls.Add(this.canvas1); + this.Controls.Add(this.canvas2); this.Name = "mainForm"; this.Text = "JuicyGraphics"; - ((System.ComponentModel.ISupportInitialize)(this.canvas1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.canvas2)).EndInit(); this.ResumeLayout(false); } #endregion - - private canvas canvas1; + private canvas canvas2; } } diff --git a/src/JuicyGraphics.csproj b/src/JuicyGraphics.csproj index d4dd424..24b93e2 100644 --- a/src/JuicyGraphics.csproj +++ b/src/JuicyGraphics.csproj @@ -20,6 +20,7 @@ DEBUG;TRACE prompt 4 + true AnyCPU @@ -31,15 +32,6 @@ 4 - - packages\SharpGL.2.4.0.0\lib\net40\SharpGL.dll - - - packages\SharpGL.2.4.0.0\lib\net40\SharpGL.SceneGraph.dll - - - packages\SharpGL.WinForms.2.4.0.0\lib\net40\SharpGL.WinForms.dll - @@ -64,6 +56,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + Form1.cs @@ -76,7 +92,6 @@ True Resources.resx - SettingsSingleFileGenerator Settings.Designer.cs @@ -90,5 +105,6 @@ + \ No newline at end of file diff --git a/src/SharpGL/DIBSection.cs b/src/SharpGL/DIBSection.cs new file mode 100644 index 0000000..9151a52 --- /dev/null +++ b/src/SharpGL/DIBSection.cs @@ -0,0 +1,197 @@ +using System; +using System.Runtime.InteropServices; + +namespace SharpGL +{ + /// + /// + /// + public class DIBSection : IDisposable + { + /// + /// Creates the specified width. + /// + /// The width. + /// The height. + /// The bit count. + /// + public virtual unsafe bool Create(IntPtr hDC, int width, int height, int bitCount) + { + this.width = width; + this.height = height; + parentDC = hDC; + + // Destroy existing objects. + Destroy(); + + // Create a bitmap info structure. + Win32.BITMAPINFO info = new Win32.BITMAPINFO(); + info.Init(); + + // Set the data. + info.biBitCount = (short)bitCount; + info.biPlanes = 1; + info.biWidth = width; + info.biHeight = height; + + // Create the bitmap. + hBitmap = Win32.CreateDIBSection(hDC, ref info, Win32.DIB_RGB_COLORS, + out bits, IntPtr.Zero, 0); + + Win32.SelectObject(hDC, hBitmap); + + // Set the OpenGL pixel format. + SetPixelFormat(hDC, bitCount); + + return true; + } + + /// + /// Resizes the section. + /// + /// The width. + /// The height. + /// The bit count. + public void Resize(int width, int height, int bitCount) + { + // Destroy existing objects. + Destroy(); + + // Set parameters. + Width = width; + Height = height; + + // Create a bitmap info structure. + Win32.BITMAPINFO info = new Win32.BITMAPINFO(); + info.Init(); + + // Set the data. + info.biBitCount = (short)bitCount; + info.biPlanes = 1; + info.biWidth = width; + info.biHeight = height; + + // Create the bitmap. + hBitmap = Win32.CreateDIBSection(parentDC, ref info, Win32.DIB_RGB_COLORS, + out bits, IntPtr.Zero, 0); + + Win32.SelectObject(parentDC, hBitmap); + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + Destroy(); + } + + /// + /// This function sets the pixel format of the underlying bitmap. + /// + /// The bitcount. + protected virtual bool SetPixelFormat(IntPtr hDC, int bitCount) + { + // Create the big lame pixel format majoo. + Win32.PIXELFORMATDESCRIPTOR pixelFormat = new Win32.PIXELFORMATDESCRIPTOR(); + pixelFormat.Init(); + + // Set the values for the pixel format. + pixelFormat.nVersion = 1; + pixelFormat.dwFlags = (Win32.PFD_DRAW_TO_BITMAP | Win32.PFD_SUPPORT_OPENGL | Win32.PFD_SUPPORT_GDI); + pixelFormat.iPixelType = Win32.PFD_TYPE_RGBA; + pixelFormat.cColorBits = (byte)bitCount; + pixelFormat.cDepthBits = 32; + pixelFormat.iLayerType = Win32.PFD_MAIN_PLANE; + + // Match an appropriate pixel format + int iPixelformat; + if((iPixelformat = Win32.ChoosePixelFormat(hDC, pixelFormat)) == 0 ) + return false; + + // Sets the pixel format + if (Win32.SetPixelFormat(hDC, iPixelformat, pixelFormat) == 0) + { + int lastError = Marshal.GetLastWin32Error(); + return false; + } + + return true; + } + + /// + /// Destroys this instance. + /// + public virtual void Destroy() + { + // Destroy the bitmap. + if(hBitmap != IntPtr.Zero) + { + Win32.DeleteObject(hBitmap); + hBitmap = IntPtr.Zero; + } + } + + /// + /// The parent dc. + /// + protected IntPtr parentDC = IntPtr.Zero; + + /// + /// The bitmap handle. + /// + protected IntPtr hBitmap = IntPtr.Zero; + + /// + /// The bits. + /// + protected IntPtr bits = IntPtr.Zero; + + /// + /// The width. + /// + protected int width = 0; + + /// + /// The height. + /// + protected int height = 0; + + /// + /// Gets the handle to the bitmap. + /// + /// The handle to the bitmap. + public IntPtr HBitmap + { + get {return hBitmap;} + } + + /// + /// Gets the bits. + /// + public IntPtr Bits + { + get { return bits; } + } + + /// + /// Gets or sets the width. + /// + /// The width. + public int Width + { + get { return width; } + protected set { width = value; } + } + + /// + /// Gets or sets the height. + /// + /// The height. + public int Height + { + get {return height;} + protected set { height = value; } + } + } +} \ No newline at end of file diff --git a/src/SharpGL/Enumerations/OpenGLEnumerations.cs b/src/SharpGL/Enumerations/OpenGLEnumerations.cs new file mode 100644 index 0000000..fb97fe4 --- /dev/null +++ b/src/SharpGL/Enumerations/OpenGLEnumerations.cs @@ -0,0 +1,695 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.Enumerations +{ + /// + /// AccumOp + /// + public enum AccumOperation : uint + { + Accum = OpenGL.GL_ACCUM, + Load = OpenGL.GL_LOAD, + Return = OpenGL.GL_RETURN, + Multiple = OpenGL.GL_MULT, + Add = OpenGL.GL_ADD + } + + /// + /// The alpha function + /// + public enum AlphaTestFunction : uint + { + Never = OpenGL.GL_NEVER, + Less = OpenGL.GL_LESS, + Equal = OpenGL.GL_EQUAL, + LessThanOrEqual = OpenGL.GL_LEQUAL, + Great = OpenGL.GL_GREATER, + NotEqual = OpenGL.GL_NOTEQUAL, + GreaterThanOrEqual = OpenGL.GL_GEQUAL, + Always = OpenGL.GL_ALWAYS, + } + + /// + /// The OpenGL Attribute flags. + /// + [Flags] + public enum AttributeMask : uint + { + None = 0, + Current = OpenGL.GL_CURRENT_BIT, + Point = OpenGL.GL_POINT_BIT, + Line = OpenGL.GL_LINE_BIT, + Polygon = OpenGL.GL_POLYGON_BIT, + PolygonStipple = OpenGL.GL_POLYGON_STIPPLE_BIT, + PixelMode = OpenGL.GL_PIXEL_MODE_BIT, + Lighting = OpenGL.GL_LIGHTING_BIT, + Fog = OpenGL.GL_FOG_BIT, + DepthBuffer = OpenGL.GL_DEPTH_BUFFER_BIT, + AccumBuffer = OpenGL.GL_ACCUM_BUFFER_BIT, + StencilBuffer = OpenGL.GL_STENCIL_BUFFER_BIT, + Viewport = OpenGL.GL_VIEWPORT_BIT, + Transform = OpenGL.GL_TRANSFORM_BIT, + Enable = OpenGL.GL_ENABLE_BIT, + ColorBuffer = OpenGL.GL_COLOR_BUFFER_BIT, + Hint = OpenGL.GL_HINT_BIT, + Eval = OpenGL.GL_EVAL_BIT, + List = OpenGL.GL_LIST_BIT, + Texture = OpenGL.GL_TEXTURE_BIT, + Scissor = OpenGL.GL_SCISSOR_BIT, + All = OpenGL.GL_ALL_ATTRIB_BITS, + } + + /// + /// The begin mode. + /// + public enum BeginMode : uint + { + Points = OpenGL.GL_POINTS, + Lines = OpenGL.GL_LINES, + LineLoop = OpenGL.GL_LINE_LOOP, + LineStrip = OpenGL.GL_LINE_STRIP, + Triangles = OpenGL.GL_TRIANGLES, + TriangleString = OpenGL.GL_TRIANGLE_STRIP, + TriangleFan = OpenGL.GL_TRIANGLE_FAN, + Quads= OpenGL.GL_QUADS, + QuadStrip = OpenGL.GL_QUAD_STRIP, + Polygon = OpenGL.GL_POLYGON + } + + /// + /// BlendingDestinationFactor + /// + public enum BlendingDestinationFactor : uint + { + Zero = OpenGL.GL_ZERO, + One = OpenGL.GL_ONE, + SourceColor = OpenGL.GL_SRC_COLOR, + OneMinusSourceColor = OpenGL.GL_ONE_MINUS_SRC_COLOR, + SourceAlpha = OpenGL.GL_SRC_ALPHA, + OneMinusSourceAlpha = OpenGL.GL_ONE_MINUS_SRC_ALPHA, + DestinationAlpha = OpenGL.GL_DST_ALPHA, + OneMinusDestinationAlpha = OpenGL.GL_ONE_MINUS_DST_ALPHA, + } + + /// + /// The blending source factor. + /// + public enum BlendingSourceFactor : uint + { + DestinationColor = OpenGL.GL_DST_COLOR, + OneMinusDestinationColor = OpenGL.GL_ONE_MINUS_DST_COLOR, + SourceAlphaSaturate = OpenGL.GL_SRC_ALPHA_SATURATE, + /// + /// + /// + SourceAlpha = OpenGL.GL_SRC_ALPHA + } + + /// + /// The Clip Plane Name + /// + public enum ClipPlaneName : uint + { + ClipPlane0 = OpenGL.GL_CLIP_PLANE0, + ClipPlane1 = OpenGL.GL_CLIP_PLANE1, + ClipPlane2 = OpenGL.GL_CLIP_PLANE2, + ClipPlane3 = OpenGL.GL_CLIP_PLANE3, + ClipPlane4 = OpenGL.GL_CLIP_PLANE4, + ClipPlane5 = OpenGL.GL_CLIP_PLANE5 + } + + /// + /// The Cull Face mode. + /// + public enum FaceMode : uint + { + /// + /// + /// + Front = OpenGL.GL_FRONT, + FrontAndBack = OpenGL.GL_FRONT_AND_BACK, + Back = OpenGL.GL_BACK, + } + + /// + /// The Data Type. + /// + public enum DataType : uint + { + Byte = OpenGL.GL_BYTE, + UnsignedByte = OpenGL.GL_UNSIGNED_BYTE, + Short = OpenGL.GL_SHORT, + UnsignedShort = OpenGL.GL_UNSIGNED_SHORT, + Int = OpenGL.GL_INT, + UnsignedInt = OpenGL.GL_UNSIGNED_INT, + Float = OpenGL.GL_FLOAT, + TwoBytes = OpenGL.GL_2_BYTES, + ThreeBytes = OpenGL.GL_3_BYTES, + FourBytes = OpenGL.GL_4_BYTES, + /// + /// + /// + Double= OpenGL.GL_DOUBLE + } + + /// + /// The depth function + /// + public enum DepthFunction : uint + { + Never = OpenGL.GL_NEVER, + Less = OpenGL.GL_LESS, + Equal = OpenGL.GL_EQUAL, + LessThanOrEqual = OpenGL.GL_LEQUAL, + Great = OpenGL.GL_GREATER, + NotEqual = OpenGL.GL_NOTEQUAL, + GreaterThanOrEqual = OpenGL.GL_GEQUAL, + Always = OpenGL.GL_ALWAYS, + } + + /// + /// The Draw Buffer Mode + /// + public enum DrawBufferMode : uint + { + None = OpenGL.GL_NONE, + FrontLeft = OpenGL.GL_FRONT_LEFT, + FrontRight = OpenGL.GL_FRONT_RIGHT, + BackLeft = OpenGL.GL_BACK_LEFT, + BackRight = OpenGL.GL_BACK_RIGHT, + Front = OpenGL.GL_FRONT, + Back = OpenGL.GL_BACK, + Left = OpenGL.GL_LEFT, + Right = OpenGL.GL_RIGHT, + FrontAndBack = OpenGL.GL_FRONT_AND_BACK, + Auxilliary0= OpenGL.GL_AUX0, + Auxilliary1 = OpenGL.GL_AUX1, + Auxilliary2 = OpenGL.GL_AUX2, + Auxilliary3 = OpenGL.GL_AUX3, + } + + /// + /// Error Code + /// + public enum ErrorCode : uint + { + NoError = OpenGL.GL_NO_ERROR, + InvalidEnum = OpenGL.GL_INVALID_ENUM, + InvalidValue = OpenGL.GL_INVALID_VALUE, + InvalidOperation = OpenGL.GL_INVALID_OPERATION, + StackOverflow = OpenGL.GL_STACK_OVERFLOW, + StackUnderflow = OpenGL.GL_STACK_UNDERFLOW, + OutOfMemory = OpenGL.GL_OUT_OF_MEMORY + } + + /// + /// FeedBackMode + /// + public enum FeedbackMode : uint + { + TwoD = OpenGL.GL_2D, + ThreeD = OpenGL.GL_3D, + FourD = OpenGL.GL_4D_COLOR, + ThreeDColorTexture = OpenGL.GL_3D_COLOR_TEXTURE, + FourDColorTexture = OpenGL.GL_4D_COLOR_TEXTURE + } + + /// + /// The Feedback Token + /// + public enum FeedbackToken : uint + { + PassThroughToken = OpenGL.GL_PASS_THROUGH_TOKEN, + PointToken = OpenGL.GL_POINT_TOKEN, + LineToken = OpenGL.GL_LINE_TOKEN, + PolygonToken = OpenGL.GL_POLYGON_TOKEN, + BitmapToken = OpenGL.GL_BITMAP_TOKEN, + DrawPixelToken = OpenGL.GL_DRAW_PIXEL_TOKEN, + CopyPixelToken = OpenGL.GL_COPY_PIXEL_TOKEN, + LineResetToken = OpenGL.GL_LINE_RESET_TOKEN + } + + /// + /// The Fog Mode. + /// + public enum FogMode : uint + { + Exp = OpenGL.GL_EXP, + + /// + /// + /// + Exp2 = OpenGL.GL_EXP2, + } + + /// + /// GetMapTarget + /// + public enum GetMapTarget : uint + { + Coeff = OpenGL.GL_COEFF, + Order = OpenGL.GL_ORDER, + Domain = OpenGL.GL_DOMAIN + } + + public enum GetTarget : uint + { + CurrentColor = OpenGL.GL_CURRENT_COLOR, + CurrentIndex = OpenGL.GL_CURRENT_INDEX, + CurrentNormal = OpenGL.GL_CURRENT_NORMAL, + CurrentTextureCoords = OpenGL.GL_CURRENT_TEXTURE_COORDS, + CurrentRasterColor = OpenGL.GL_CURRENT_RASTER_COLOR, + CurrentRasterIndex = OpenGL.GL_CURRENT_RASTER_INDEX, + CurrentRasterTextureCoords = OpenGL.GL_CURRENT_RASTER_TEXTURE_COORDS, + CurrentRasterPosition = OpenGL.GL_CURRENT_RASTER_POSITION, + CurrentRasterPositionValid = OpenGL.GL_CURRENT_RASTER_POSITION_VALID, + CurrentRasterDistance = OpenGL.GL_CURRENT_RASTER_DISTANCE, + PointSmooth = OpenGL.GL_POINT_SMOOTH, + PointSize = OpenGL.GL_POINT_SIZE, + PointSizeRange = OpenGL.GL_POINT_SIZE_RANGE, + PointSizeGranularity = OpenGL.GL_POINT_SIZE_GRANULARITY, + LineSmooth = OpenGL.GL_LINE_SMOOTH, + LineWidth = OpenGL.GL_LINE_WIDTH, + LineWidthRange = OpenGL.GL_LINE_WIDTH_RANGE, + LineWidthGranularity = OpenGL.GL_LINE_WIDTH_GRANULARITY, + LineStipple = OpenGL.GL_LINE_STIPPLE, + LineStipplePattern = OpenGL.GL_LINE_STIPPLE_PATTERN, + LineStippleRepeat = OpenGL.GL_LINE_STIPPLE_REPEAT, + ListMode = OpenGL.GL_LIST_MODE, + MaxListNesting = OpenGL.GL_MAX_LIST_NESTING, + ListBase = OpenGL.GL_LIST_BASE, + ListIndex = OpenGL.GL_LIST_INDEX, + PolygonMode = OpenGL.GL_POLYGON_MODE, + PolygonSmooth = OpenGL.GL_POLYGON_SMOOTH, + PolygonStipple = OpenGL.GL_POLYGON_STIPPLE, + EdgeFlag = OpenGL.GL_EDGE_FLAG, + CullFace = OpenGL.GL_CULL_FACE, + CullFaceMode = OpenGL.GL_CULL_FACE_MODE, + FrontFace = OpenGL.GL_FRONT_FACE, + Lighting = OpenGL.GL_LIGHTING, + LightModelLocalViewer = OpenGL.GL_LIGHT_MODEL_LOCAL_VIEWER, + LightModelTwoSide = OpenGL.GL_LIGHT_MODEL_TWO_SIDE, + LightModelAmbient = OpenGL.GL_LIGHT_MODEL_AMBIENT, + ShadeModel = OpenGL.GL_SHADE_MODEL, + ColorMaterialFace = OpenGL.GL_COLOR_MATERIAL_FACE, + ColorMaterialParameter = OpenGL.GL_COLOR_MATERIAL_PARAMETER, + ColorMaterial = OpenGL.GL_COLOR_MATERIAL, + Fog = OpenGL.GL_FOG, + FogIndex = OpenGL.GL_FOG_INDEX, + FogDensity = OpenGL.GL_FOG_DENSITY, + FogStart = OpenGL.GL_FOG_START, + FogEnd = OpenGL.GL_FOG_END, + FogMode = OpenGL.GL_FOG_MODE, + FogColor = OpenGL.GL_FOG_COLOR, + DepthRange = OpenGL.GL_DEPTH_RANGE, + DepthTest = OpenGL.GL_DEPTH_TEST, + DepthWritemask = OpenGL.GL_DEPTH_WRITEMASK, + DepthClearValue = OpenGL.GL_DEPTH_CLEAR_VALUE, + DepthFunc = OpenGL.GL_DEPTH_FUNC, + AccumClearValue = OpenGL.GL_ACCUM_CLEAR_VALUE, + StencilTest = OpenGL.GL_STENCIL_TEST, + StencilClearValue = OpenGL.GL_STENCIL_CLEAR_VALUE, + StencilFunc = OpenGL.GL_STENCIL_FUNC, + StencilValueMask = OpenGL.GL_STENCIL_VALUE_MASK, + StencilFail = OpenGL.GL_STENCIL_FAIL, + StencilPassDepthFail = OpenGL.GL_STENCIL_PASS_DEPTH_FAIL, + StencilPassDepthPass = OpenGL.GL_STENCIL_PASS_DEPTH_PASS, + StencilRef = OpenGL.GL_STENCIL_REF, + StencilWritemask = OpenGL.GL_STENCIL_WRITEMASK, + MatrixMode = OpenGL.GL_MATRIX_MODE, + Normalize = OpenGL.GL_NORMALIZE, + Viewport = OpenGL.GL_VIEWPORT, + ModelviewStackDepth = OpenGL.GL_MODELVIEW_STACK_DEPTH, + ProjectionStackDepth = OpenGL.GL_PROJECTION_STACK_DEPTH, + TextureStackDepth = OpenGL.GL_TEXTURE_STACK_DEPTH, + ModelviewMatix = OpenGL.GL_MODELVIEW_MATRIX, + ProjectionMatrix = OpenGL.GL_PROJECTION_MATRIX, + TextureMatrix = OpenGL.GL_TEXTURE_MATRIX, + AttribStackDepth = OpenGL.GL_ATTRIB_STACK_DEPTH, + ClientAttribStackDepth = OpenGL.GL_CLIENT_ATTRIB_STACK_DEPTH, + AlphaTest = OpenGL.GL_ALPHA_TEST, + AlphaTestFunc = OpenGL.GL_ALPHA_TEST_FUNC, + AlphaTestRef = OpenGL.GL_ALPHA_TEST_REF, + Dither = OpenGL.GL_DITHER, + BlendDst = OpenGL.GL_BLEND_DST, + BlendSrc = OpenGL.GL_BLEND_SRC, + Blend = OpenGL.GL_BLEND, + LogicOpMode = OpenGL.GL_LOGIC_OP_MODE, + IndexLogicOp = OpenGL.GL_INDEX_LOGIC_OP, + ColorLogicOp = OpenGL.GL_COLOR_LOGIC_OP, + AuxBuffers = OpenGL.GL_AUX_BUFFERS, + DrawBuffer = OpenGL.GL_DRAW_BUFFER, + ReadBuffer = OpenGL.GL_READ_BUFFER, + ScissorBox = OpenGL.GL_SCISSOR_BOX, + ScissorTest = OpenGL.GL_SCISSOR_TEST, + IndexClearValue = OpenGL.GL_INDEX_CLEAR_VALUE, + IndexWritemask = OpenGL.GL_INDEX_WRITEMASK, + ColorClearValue = OpenGL.GL_COLOR_CLEAR_VALUE, + ColorWritemask = OpenGL.GL_COLOR_WRITEMASK, + IndexMode = OpenGL.GL_INDEX_MODE, + RgbaMode = OpenGL.GL_RGBA_MODE, + DoubleBuffer = OpenGL.GL_DOUBLEBUFFER, + Stereo = OpenGL.GL_STEREO, + RenderMode = OpenGL.GL_RENDER_MODE, + PerspectiveCorrectionHint = OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, + PointSmoothHint = OpenGL.GL_POINT_SMOOTH_HINT, + LineSmoothHint = OpenGL.GL_LINE_SMOOTH_HINT, + PolygonSmoothHint = OpenGL.GL_POLYGON_SMOOTH_HINT, + FogHint = OpenGL.GL_FOG_HINT, + TextureGenS = OpenGL.GL_TEXTURE_GEN_S, + TextureGenT = OpenGL.GL_TEXTURE_GEN_T, + TextureGenR = OpenGL.GL_TEXTURE_GEN_R, + TextureGenQ = OpenGL.GL_TEXTURE_GEN_Q, + PixelMapItoI = OpenGL.GL_PIXEL_MAP_I_TO_I, + PixelMapStoS = OpenGL.GL_PIXEL_MAP_S_TO_S, + PixelMapItoR = OpenGL.GL_PIXEL_MAP_I_TO_R, + PixelMapItoG = OpenGL.GL_PIXEL_MAP_I_TO_G, + PixelMapItoB = OpenGL.GL_PIXEL_MAP_I_TO_B, + PixelMapItoA = OpenGL.GL_PIXEL_MAP_I_TO_A, + PixelMapRtoR = OpenGL.GL_PIXEL_MAP_R_TO_R, + PixelMapGtoG = OpenGL.GL_PIXEL_MAP_G_TO_G, + PixelMapBtoB = OpenGL.GL_PIXEL_MAP_B_TO_B, + PixelMapAtoA = OpenGL.GL_PIXEL_MAP_A_TO_A, + PixelMapItoISize = OpenGL.GL_PIXEL_MAP_I_TO_I_SIZE, + PixelMapStoSSize = OpenGL.GL_PIXEL_MAP_S_TO_S_SIZE, + PixelMapItoRSize = OpenGL.GL_PIXEL_MAP_I_TO_R_SIZE, + PixelMapItoGSize = OpenGL.GL_PIXEL_MAP_I_TO_G_SIZE, + PixelMapItoBSize = OpenGL.GL_PIXEL_MAP_I_TO_B_SIZE, + PixelMapItoASize = OpenGL.GL_PIXEL_MAP_I_TO_A_SIZE, + PixelMapRtoRSize = OpenGL.GL_PIXEL_MAP_R_TO_R_SIZE, + PixelMapGtoGSize = OpenGL.GL_PIXEL_MAP_G_TO_G_SIZE, + PixelMapBtoBSize = OpenGL.GL_PIXEL_MAP_B_TO_B_SIZE, + PixelMapAtoASize = OpenGL.GL_PIXEL_MAP_A_TO_A_SIZE, + UnpackSwapBytes = OpenGL.GL_UNPACK_SWAP_BYTES, + LsbFirst = OpenGL.GL_UNPACK_LSB_FIRST, + UnpackRowLength = OpenGL.GL_UNPACK_ROW_LENGTH, + UnpackSkipRows = OpenGL.GL_UNPACK_SKIP_ROWS, + UnpackSkipPixels = OpenGL.GL_UNPACK_SKIP_PIXELS, + UnpackAlignment = OpenGL.GL_UNPACK_ALIGNMENT, + PackSwapBytes = OpenGL.GL_PACK_SWAP_BYTES, + PackLsbFirst = OpenGL.GL_PACK_LSB_FIRST, + PackRowLength = OpenGL.GL_PACK_ROW_LENGTH, + PackSkipRows = OpenGL.GL_PACK_SKIP_ROWS, + PackSkipPixels = OpenGL.GL_PACK_SKIP_PIXELS, + PackAlignment = OpenGL.GL_PACK_ALIGNMENT, + MapColor = OpenGL.GL_MAP_COLOR, + MapStencil = OpenGL.GL_MAP_STENCIL, + IndexShift = OpenGL.GL_INDEX_SHIFT, + IndexOffset = OpenGL.GL_INDEX_OFFSET, + RedScale = OpenGL.GL_RED_SCALE, + RedBias = OpenGL.GL_RED_BIAS, + ZoomX = OpenGL.GL_ZOOM_X, + ZoomY = OpenGL.GL_ZOOM_Y, + GreenScale = OpenGL.GL_GREEN_SCALE, + GreenBias = OpenGL.GL_GREEN_BIAS, + BlueScale = OpenGL.GL_BLUE_SCALE, + BlueBias = OpenGL.GL_BLUE_BIAS, + AlphaScale = OpenGL.GL_ALPHA_SCALE, + AlphaBias = OpenGL.GL_ALPHA_BIAS, + DepthScale = OpenGL.GL_DEPTH_SCALE, + DepthBias = OpenGL.GL_DEPTH_BIAS, + MapEvalOrder = OpenGL.GL_MAX_EVAL_ORDER, + MaxLights = OpenGL.GL_MAX_LIGHTS, + MaxClipPlanes = OpenGL.GL_MAX_CLIP_PLANES, + MaxTextureSize = OpenGL.GL_MAX_TEXTURE_SIZE, + MapPixelMapTable = OpenGL.GL_MAX_PIXEL_MAP_TABLE, + MaxAttribStackDepth = OpenGL.GL_MAX_ATTRIB_STACK_DEPTH, + MaxModelviewStackDepth = OpenGL.GL_MAX_MODELVIEW_STACK_DEPTH, + MaxNameStackDepth = OpenGL.GL_MAX_NAME_STACK_DEPTH, + MaxProjectionStackDepth = OpenGL.GL_MAX_PROJECTION_STACK_DEPTH, + MaxTextureStackDepth = OpenGL.GL_MAX_TEXTURE_STACK_DEPTH, + MaxViewportDims = OpenGL.GL_MAX_VIEWPORT_DIMS, + MaxClientAttribStackDepth = OpenGL.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, + SubpixelBits = OpenGL.GL_SUBPIXEL_BITS, + IndexBits = OpenGL.GL_INDEX_BITS, + RedBits = OpenGL.GL_RED_BITS, + GreenBits = OpenGL.GL_GREEN_BITS, + BlueBits = OpenGL.GL_BLUE_BITS, + AlphaBits = OpenGL.GL_ALPHA_BITS, + DepthBits = OpenGL.GL_DEPTH_BITS, + StencilBits = OpenGL.GL_STENCIL_BITS, + AccumRedBits = OpenGL.GL_ACCUM_RED_BITS, + AccumGreenBits = OpenGL.GL_ACCUM_GREEN_BITS, + AccumBlueBits = OpenGL.GL_ACCUM_BLUE_BITS, + AccumAlphaBits = OpenGL.GL_ACCUM_ALPHA_BITS, + NameStackDepth = OpenGL.GL_NAME_STACK_DEPTH, + AutoNormal = OpenGL.GL_AUTO_NORMAL, + Map1Color4 = OpenGL.GL_MAP1_COLOR_4, + Map1Index = OpenGL.GL_MAP1_INDEX, + Map1Normal = OpenGL.GL_MAP1_NORMAL, + Map1TextureCoord1 = OpenGL.GL_MAP1_TEXTURE_COORD_1, + Map1TextureCoord2 = OpenGL.GL_MAP1_TEXTURE_COORD_2, + Map1TextureCoord3 = OpenGL.GL_MAP1_TEXTURE_COORD_3, + Map1TextureCoord4 = OpenGL.GL_MAP1_TEXTURE_COORD_4, + Map1Vertex3 = OpenGL.GL_MAP1_VERTEX_3, + Map1Vertex4 = OpenGL.GL_MAP1_VERTEX_4, + Map2Color4 = OpenGL.GL_MAP2_COLOR_4, + Map2Index = OpenGL.GL_MAP2_INDEX, + Map2Normal = OpenGL.GL_MAP2_NORMAL, + Map2TextureCoord1 = OpenGL.GL_MAP2_TEXTURE_COORD_1, + Map2TextureCoord2 = OpenGL.GL_MAP2_TEXTURE_COORD_2, + Map2TextureCoord3 = OpenGL.GL_MAP2_TEXTURE_COORD_3, + Map2TextureCoord4 = OpenGL.GL_MAP2_TEXTURE_COORD_4, + Map2Vertex3 = OpenGL.GL_MAP2_VERTEX_3, + Map2Vertex4 = OpenGL.GL_MAP2_VERTEX_4, + Map1GridDomain = OpenGL.GL_MAP1_GRID_DOMAIN, + Map1GridSegments = OpenGL.GL_MAP1_GRID_SEGMENTS, + Map2GridDomain = OpenGL.GL_MAP2_GRID_DOMAIN, + Map2GridSegments = OpenGL.GL_MAP2_GRID_SEGMENTS, + Texture1D = OpenGL.GL_TEXTURE_1D, + Texture2D = OpenGL.GL_TEXTURE_2D, + FeedbackBufferPointer = OpenGL.GL_FEEDBACK_BUFFER_POINTER, + FeedbackBufferSize = OpenGL.GL_FEEDBACK_BUFFER_SIZE, + FeedbackBufferType = OpenGL.GL_FEEDBACK_BUFFER_TYPE, + SelectionBufferPointer = OpenGL.GL_SELECTION_BUFFER_POINTER, + SelectionBufferSize = OpenGL.GL_SELECTION_BUFFER_SIZE + } + + /// + /// The Front Face Mode. + /// + public enum FrontFaceMode : uint + { + ClockWise = OpenGL.GL_CW, + CounterClockWise = OpenGL.GL_CCW, + } + + + /// + /// The hint mode. + /// + public enum HintMode : uint + { + DontCare = OpenGL.GL_DONT_CARE, + Fastest = OpenGL.GL_FASTEST, + /// + /// The + /// + Nicest = OpenGL.GL_NICEST + } + + /// + /// The hint target. + /// + public enum HintTarget : uint + { + PerspectiveCorrection = OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, + PointSmooth = OpenGL.GL_POINT_SMOOTH_HINT, + LineSmooth = OpenGL.GL_LINE_SMOOTH_HINT, + PolygonSmooth = OpenGL.GL_POLYGON_SMOOTH_HINT, + Fog = OpenGL.GL_FOG_HINT + } + + /// + /// LightName + /// + public enum LightName : uint + { + Light0 = OpenGL.GL_LIGHT0 , + Light1 = OpenGL.GL_LIGHT1, + Light2 = OpenGL.GL_LIGHT2, + Light3 = OpenGL.GL_LIGHT3, + Light4 = OpenGL.GL_LIGHT4, + Light5 = OpenGL.GL_LIGHT5, + Light6 = OpenGL.GL_LIGHT6, + Light7 = OpenGL.GL_LIGHT7 + } + + /// + /// LightParameter + /// + public enum LightParameter : uint + { + Ambient = OpenGL.GL_AMBIENT, + Diffuse = OpenGL.GL_DIFFUSE, + Specular = OpenGL.GL_SPECULAR, + Position = OpenGL.GL_POSITION, + SpotDirection = OpenGL.GL_SPOT_DIRECTION, + SpotExponent = OpenGL.GL_SPOT_EXPONENT, + SpotCutoff = OpenGL.GL_SPOT_CUTOFF, + ConstantAttenuatio = OpenGL.GL_CONSTANT_ATTENUATION, + LinearAttenuation = OpenGL.GL_LINEAR_ATTENUATION, + QuadraticAttenuation = OpenGL.GL_QUADRATIC_ATTENUATION + } + + /// + /// The Light Model Parameter. + /// + public enum LightModelParameter : uint + { + LocalViewer = OpenGL.GL_LIGHT_MODEL_LOCAL_VIEWER, + TwoSide = OpenGL.GL_LIGHT_MODEL_TWO_SIDE, + Ambient = OpenGL.GL_LIGHT_MODEL_AMBIENT + } + + /// + /// The Logic Op + /// + public enum LogicOp : uint + { + Clear = OpenGL.GL_CLEAR, + And = OpenGL.GL_AND, + AndReverse = OpenGL.GL_AND_REVERSE, + Copy = OpenGL.GL_COPY, + AndInverted = OpenGL.GL_AND_INVERTED, + NoOp= OpenGL.GL_NOOP, + XOr = OpenGL.GL_XOR, + Or = OpenGL.GL_OR, + NOr= OpenGL.GL_NOR, + Equiv = OpenGL.GL_EQUIV, + Invert = OpenGL.GL_INVERT, + OrReverse = OpenGL.GL_OR_REVERSE, + CopyInverted = OpenGL.GL_COPY_INVERTED, + OrInverted = OpenGL.GL_OR_INVERTED, + NAnd= OpenGL.GL_NAND, + Set = OpenGL.GL_SET, + } + + /// + /// The matrix mode. + /// + public enum MatrixMode : uint + { + Modelview = OpenGL.GL_MODELVIEW, + Projection = OpenGL.GL_PROJECTION, + Texture = OpenGL.GL_TEXTURE + } + + /// + /// The pixel transfer parameter name + /// + public enum PixelTransferParameterName : uint + { + MapColor = OpenGL.GL_MAP_COLOR, + MapStencil = OpenGL.GL_MAP_STENCIL, + IndexShift = OpenGL.GL_INDEX_SHIFT, + IndexOffset = OpenGL.GL_INDEX_OFFSET, + RedScale = OpenGL.GL_RED_SCALE, + RedBias = OpenGL.GL_RED_BIAS, + ZoomX = OpenGL.GL_ZOOM_X, + ZoomY = OpenGL.GL_ZOOM_Y, + GreenScale = OpenGL.GL_GREEN_SCALE, + GreenBias = OpenGL.GL_GREEN_BIAS, + BlueScale = OpenGL.GL_BLUE_SCALE, + BlueBias = OpenGL.GL_BLUE_BIAS, + AlphaScale = OpenGL.GL_ALPHA_SCALE, + AlphaBias = OpenGL.GL_ALPHA_BIAS, + DepthScale = OpenGL.GL_DEPTH_SCALE, + DepthBias = OpenGL.GL_DEPTH_BIAS + } + + /// + /// The Polygon mode. + /// + public enum PolygonMode : uint + { + /// + /// Render as points. + /// + Points = OpenGL.GL_POINT, + + /// + /// Render as lines. + /// + Lines = OpenGL.GL_LINE, + + /// + /// Render as filled. + /// + Filled = OpenGL.GL_FILL + } + + /// + /// Rendering Mode + /// + public enum RenderingMode: uint + { + Render = OpenGL.GL_RENDER, + Feedback = OpenGL.GL_FEEDBACK, + Select = OpenGL.GL_SELECT + } + + /// + /// ShadingModel + /// + public enum ShadeModel : uint + { + Flat = OpenGL.GL_FLAT, + Smooth = OpenGL.GL_SMOOTH + } + + /// + /// The stencil function + /// + public enum StencilFunction : uint + { + Never = OpenGL.GL_NEVER, + Less = OpenGL.GL_LESS, + Equal = OpenGL.GL_EQUAL, + LessThanOrEqual = OpenGL.GL_LEQUAL, + Great = OpenGL.GL_GREATER, + NotEqual = OpenGL.GL_NOTEQUAL, + GreaterThanOrEqual = OpenGL.GL_GEQUAL, + Always = OpenGL.GL_ALWAYS, + } + + /// + /// The stencil operation. + /// + public enum StencilOperation : uint + { + Keep = OpenGL.GL_KEEP, + Replace = OpenGL.GL_REPLACE, + Increase = OpenGL.GL_INCR, + Decrease = OpenGL.GL_DECR, + Zero = OpenGL.GL_ZERO, + IncreaseWrap = OpenGL.GL_INCR_WRAP, + DecreaseWrap = OpenGL.GL_DECR_WRAP, + Invert = OpenGL.GL_INVERT + } + + /// + /// GetTextureParameter + /// + public enum TextureParameter : uint + { + TextureWidth = OpenGL.GL_TEXTURE_WIDTH, + TextureHeight = OpenGL.GL_TEXTURE_HEIGHT, + TextureInternalFormat = OpenGL.GL_TEXTURE_INTERNAL_FORMAT, + TextureBorderColor = OpenGL.GL_TEXTURE_BORDER_COLOR, + TextureBorder = OpenGL.GL_TEXTURE_BORDER + } + + /// + /// Texture target. + /// + public enum TextureTarget : uint + { + Texture1D = OpenGL.GL_TEXTURE_1D, + Texture2D = OpenGL.GL_TEXTURE_2D, + Texture3D = OpenGL.GL_TEXTURE_3D + } +} diff --git a/src/SharpGL/FontBitmaps.cs b/src/SharpGL/FontBitmaps.cs new file mode 100644 index 0000000..249ef6a --- /dev/null +++ b/src/SharpGL/FontBitmaps.cs @@ -0,0 +1,318 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL +{ + /// + /// A FontOutline entry contains the details of a font face. + /// + internal class FontOutlineEntry + { + /// + /// Gets or sets the HDC. + /// + /// + /// The HDC. + /// + public IntPtr HDC + { + get; + set; + } + + /// + /// Gets or sets the HRC. + /// + /// + /// The HRC. + /// + public IntPtr HRC + { + get; + set; + } + + /// + /// Gets or sets the name of the face. + /// + /// + /// The name of the face. + /// + public string FaceName + { + get; + set; + } + + /// + /// Gets or sets the height. + /// + /// + /// The height. + /// + public int Height + { + get; + set; + } + + /// + /// Gets or sets the list base. + /// + /// + /// The list base. + /// + public uint ListBase + { + get; + set; + } + + /// + /// Gets or sets the list count. + /// + /// + /// The list count. + /// + public uint ListCount + { + get; + set; + } + + /// + /// Gets or sets the deviation. + /// + /// + /// The deviation. + /// + public float Deviation + { + get; + set; + } + + /// + /// Gets or sets the extrusion. + /// + /// + /// The extrusion. + /// + public float Extrusion + { + get; + set; + } + + /// + /// Gets or sets the font outline format. + /// + /// + /// The font outline format. + /// + public FontOutlineFormat FontOutlineFormat + { + get; + set; + } + + /// + /// Gets or sets the glyph metrics. + /// + /// + /// The glyph metrics. + /// + public GLYPHMETRICSFLOAT[] GlyphMetrics + { + get; set; + } + } + + /// + /// The font outline format. + /// + public enum FontOutlineFormat + { + /// + /// Render using lines. + /// + Lines = 0, + + /// + /// Render using polygons. + /// + Polygons = 1 + } + + /// + /// The GLYPHMETRICSFLOAT structure contains information about the placement and orientation of a glyph in a character cell. + /// + public struct GLYPHMETRICSFLOAT + { + /// + /// Specifies the width of the smallest rectangle (the glyph's black box) that completely encloses the glyph.. + /// + public float gmfBlackBoxX; + /// + /// Specifies the height of the smallest rectangle (the glyph's black box) that completely encloses the glyph. + /// + public float gmfBlackBoxY; + /// + /// Specifies the x and y coordinates of the upper-left corner of the smallest rectangle that completely encloses the glyph. + /// + public POINTFLOAT gmfptGlyphOrigin; + /// + /// Specifies the horizontal distance from the origin of the current character cell to the origin of the next character cell. + /// + public float gmfCellIncX; + /// + /// Specifies the vertical distance from the origin of the current character cell to the origin of the next character cell. + /// + public float gmfCellIncY; + } + + /// + /// Point structure used in Win32 interop. + /// + public struct POINTFLOAT + { + /// + /// The x coord value. + /// + public float x; + + /// + /// The y coord value. + /// + public float y; + + } + + /// + /// This class wraps the functionality of the wglUseFontOutlines function to + /// allow straightforward rendering of text. + /// + public class FontOutlines + { + private FontOutlineEntry CreateFontOutlineEntry(OpenGL gl, string faceName, int height, + float deviation, float extrusion, FontOutlineFormat fontOutlineFormat) + { + // Make the OpenGL instance current. + gl.MakeCurrent(); + + // Create the font based on the face name. + var hFont = Win32.CreateFont(height, 0, 0, 0, Win32.FW_DONTCARE, 0, 0, 0, Win32.DEFAULT_CHARSET, + Win32.OUT_OUTLINE_PRECIS, Win32.CLIP_DEFAULT_PRECIS, Win32.CLEARTYPE_QUALITY, Win32.VARIABLE_PITCH, faceName); + + // Select the font handle. + var hOldObject = Win32.SelectObject(gl.RenderContextProvider.DeviceContextHandle, hFont); + + // Create the list base. + var listBase = gl.GenLists(1); + + // Create space for the glyph metrics. + var glyphMetrics = new GLYPHMETRICSFLOAT[255]; + + // Create the font bitmaps. + bool result = Win32.wglUseFontOutlines(gl.RenderContextProvider.DeviceContextHandle, 0, 255, listBase, + deviation, extrusion, (int)fontOutlineFormat, glyphMetrics); + + // Reselect the old font. + Win32.SelectObject(gl.RenderContextProvider.DeviceContextHandle, hOldObject); + + // Free the font. + Win32.DeleteObject(hFont); + + // Create the font bitmap entry. + var foe = new FontOutlineEntry() + { + HDC = gl.RenderContextProvider.DeviceContextHandle, + HRC = gl.RenderContextProvider.RenderContextHandle, + FaceName = faceName, + Height = height, + ListBase = listBase, + ListCount = 255, + Deviation = deviation, + Extrusion = extrusion, + FontOutlineFormat = fontOutlineFormat, + GlyphMetrics = glyphMetrics + }; + + // Add the font bitmap entry to the internal list. + fontOutlineEntries.Add(foe); + + return foe; + } + + /// + /// Draws the text. + /// + /// The gl. + /// Name of the face. + /// Size of the font. + /// The deviation. + /// The extrusion. + /// The text. + public void DrawText(OpenGL gl, string faceName, float fontSize, + float deviation, float extrusion, string text) + { + // Pass to the glyph metrics version of the function. + GLYPHMETRICSFLOAT[] glyphMetrics; + + DrawText(gl, faceName, fontSize, deviation, extrusion, text, out glyphMetrics); + } + + /// + /// Draws the text. + /// + /// The gl. + /// Name of the face. + /// Size of the font. + /// The deviation. + /// The extrusion. + /// The text. + /// + public void DrawText(OpenGL gl, string faceName, float fontSize, float deviation, float extrusion, string text, out GLYPHMETRICSFLOAT[] glyphMetrics) + { + // Get the font size in pixels. + var fontHeight = (int)(fontSize * (16.0f / 12.0f)); + + // Do we have a font bitmap entry for this OpenGL instance and face name? + var result = (from fbe in fontOutlineEntries + where fbe.HDC == gl.RenderContextProvider.DeviceContextHandle + && fbe.HRC == gl.RenderContextProvider.RenderContextHandle + && String.Compare(fbe.FaceName, faceName, StringComparison.OrdinalIgnoreCase) == 0 + && fbe.Height == fontHeight + && fbe.Deviation == deviation + && fbe.Extrusion == extrusion + select fbe).ToList(); + + // Get the FBE or null. + var fontOutlineEntry = result.FirstOrDefault(); + + // If we don't have the FBE, we must create it. + if (fontOutlineEntry == null) + fontOutlineEntry = CreateFontOutlineEntry(gl, faceName, fontHeight, deviation, extrusion, FontOutlineFormat.Polygons); + + // Set the list base. + gl.ListBase(fontOutlineEntry.ListBase); + + // Create an array of lists for the glyphs. + var lists = text.Select(c => (byte) c).ToArray(); + + // Call the lists for the string. + gl.CallLists(lists.Length, lists); + gl.Flush(); + + // Return the glyph metrics used. + glyphMetrics = fontOutlineEntry.GlyphMetrics; + } + + /// + /// The cache of font outline entries. + /// + private readonly List fontOutlineEntries = new List(); + } +} diff --git a/src/SharpGL/FontOutlines.cs b/src/SharpGL/FontOutlines.cs new file mode 100644 index 0000000..ebb3fc6 --- /dev/null +++ b/src/SharpGL/FontOutlines.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL +{ + /// + /// A FontBitmap entry contains the details of a font face. + /// + internal class FontBitmapEntry + { + public IntPtr HDC + { + get; + set; + } + + public IntPtr HRC + { + get; + set; + } + + public string FaceName + { + get; + set; + } + + public int Height + { + get; + set; + } + + public uint ListBase + { + get; + set; + } + + public uint ListCount + { + get; + set; + } + } + + /// + /// This class wraps the functionality of the wglUseFontBitmaps function to + /// allow straightforward rendering of text. + /// + public class FontBitmaps + { + private FontBitmapEntry CreateFontBitmapEntry(OpenGL gl, string faceName, int height) + { + // Make the OpenGL instance current. + gl.MakeCurrent(); + + // Create the font based on the face name. + var hFont = Win32.CreateFont(height, 0, 0, 0, Win32.FW_DONTCARE, 0, 0, 0, Win32.DEFAULT_CHARSET, + Win32.OUT_OUTLINE_PRECIS, Win32.CLIP_DEFAULT_PRECIS, Win32.CLEARTYPE_QUALITY, Win32.VARIABLE_PITCH, faceName); + + // Select the font handle. + var hOldObject = Win32.SelectObject(gl.RenderContextProvider.DeviceContextHandle, hFont); + + // Create the list base. + var listBase = gl.GenLists(1); + + // Create the font bitmaps. + bool result = Win32.wglUseFontBitmaps(gl.RenderContextProvider.DeviceContextHandle, 0, 255, listBase); + + // Reselect the old font. + Win32.SelectObject(gl.RenderContextProvider.DeviceContextHandle, hOldObject); + + // Free the font. + Win32.DeleteObject(hFont); + + // Create the font bitmap entry. + var fbe = new FontBitmapEntry() + { + HDC = gl.RenderContextProvider.DeviceContextHandle, + HRC = gl.RenderContextProvider.RenderContextHandle, + FaceName = faceName, + Height = height, + ListBase = listBase, + ListCount = 255 + }; + + // Add the font bitmap entry to the internal list. + fontBitmapEntries.Add(fbe); + + return fbe; + } + + /// + /// Draws the text. + /// + /// The gl. + /// The x. + /// The y. + /// The r. + /// The g. + /// The b. + /// Name of the face. + /// Size of the font. + /// The text. + public void DrawText(OpenGL gl, int x, int y, float r, float g, float b, string faceName, float fontSize, string text) + { + // Get the font size in pixels. + var fontHeight = (int)(fontSize * (16.0f / 12.0f)); + + // Do we have a font bitmap entry for this OpenGL instance and face name? + var result = (from fbe in fontBitmapEntries + where fbe.HDC == gl.RenderContextProvider.DeviceContextHandle + && fbe.HRC == gl.RenderContextProvider.RenderContextHandle + && String.Compare(fbe.FaceName, faceName, StringComparison.OrdinalIgnoreCase) == 0 + && fbe.Height == fontHeight + select fbe).ToList(); + + // Get the FBE or null. + var fontBitmapEntry = result.FirstOrDefault(); + + // If we don't have the FBE, we must create it. + if (fontBitmapEntry == null) + fontBitmapEntry = CreateFontBitmapEntry(gl, faceName, fontHeight); + + double width = gl.RenderContextProvider.Width; + double height = gl.RenderContextProvider.Height; + + // Create the appropriate projection matrix. + gl.MatrixMode(OpenGL.GL_PROJECTION); + gl.PushMatrix(); + gl.LoadIdentity(); + + int[] viewport = new int[4]; + gl.GetInteger(OpenGL.GL_VIEWPORT, viewport); + gl.Ortho(0, width, 0, height, -1, 1); + + // Create the appropriate modelview matrix. + gl.MatrixMode(OpenGL.GL_MODELVIEW); + gl.PushMatrix(); + gl.LoadIdentity(); + gl.Color(r, g, b); + gl.RasterPos(x, y); + + gl.PushAttrib(OpenGL.GL_LIST_BIT | OpenGL.GL_CURRENT_BIT | + OpenGL.GL_ENABLE_BIT | OpenGL.GL_TRANSFORM_BIT); + gl.Color(r, g, b); + gl.Disable(OpenGL.GL_LIGHTING); + gl.Disable(OpenGL.GL_TEXTURE_2D); + gl.Disable(OpenGL.GL_DEPTH_TEST); + gl.RasterPos(x, y); + + // Set the list base. + gl.ListBase(fontBitmapEntry.ListBase); + + // Create an array of lists for the glyphs. + var lists = text.Select(c => (byte) c).ToArray(); + + // Call the lists for the string. + gl.CallLists(lists.Length, lists); + gl.Flush(); + + // Reset the list bit. + gl.PopAttrib(); + + // Pop the modelview. + gl.PopMatrix(); + + // back to the projection and pop it, then back to the model view. + gl.MatrixMode(OpenGL.GL_PROJECTION); + gl.PopMatrix(); + gl.MatrixMode(OpenGL.GL_MODELVIEW); + } + + /// + /// Cache of font bitmap enties. + /// + private readonly List fontBitmapEntries = new List(); + } +} diff --git a/src/SharpGL/OpenGL.cs b/src/SharpGL/OpenGL.cs new file mode 100644 index 0000000..cf64b72 --- /dev/null +++ b/src/SharpGL/OpenGL.cs @@ -0,0 +1,6937 @@ +using System; +using System.Diagnostics; +using System.ComponentModel; +using System.Runtime.InteropServices; +using SharpGL.RenderContextProviders; +using SharpGL.Version; + +namespace SharpGL +{ + /// + /// The OpenGL class wraps Suns OpenGL 3D library. + /// + public partial class OpenGL + { + #region The OpenGL constant definitions. + + // OpenGL Version Identifier + public const uint GL_VERSION_1_1 = 1; + + // AccumOp + public const uint GL_ACCUM = 0x0100; + public const uint GL_LOAD = 0x0101; + public const uint GL_RETURN = 0x0102; + public const uint GL_MULT = 0x0103; + public const uint GL_ADD = 0x0104; + + // Alpha functions + public const uint GL_NEVER = 0x0200; + public const uint GL_LESS = 0x0201; + public const uint GL_EQUAL = 0x0202; + public const uint GL_LEQUAL = 0x0203; + public const uint GL_GREATER = 0x0204; + public const uint GL_NOTEQUAL = 0x0205; + public const uint GL_GEQUAL = 0x0206; + public const uint GL_ALWAYS = 0x0207; + + // AttribMask + public const uint GL_CURRENT_BIT = 0x00000001; + public const uint GL_POINT_BIT = 0x00000002; + public const uint GL_LINE_BIT = 0x00000004; + public const uint GL_POLYGON_BIT = 0x00000008; + public const uint GL_POLYGON_STIPPLE_BIT = 0x00000010; + public const uint GL_PIXEL_MODE_BIT = 0x00000020; + public const uint GL_LIGHTING_BIT = 0x00000040; + public const uint GL_FOG_BIT = 0x00000080; + public const uint GL_DEPTH_BUFFER_BIT = 0x00000100; + public const uint GL_ACCUM_BUFFER_BIT = 0x00000200; + public const uint GL_STENCIL_BUFFER_BIT = 0x00000400; + public const uint GL_VIEWPORT_BIT = 0x00000800; + public const uint GL_TRANSFORM_BIT = 0x00001000; + public const uint GL_ENABLE_BIT = 0x00002000; + public const uint GL_COLOR_BUFFER_BIT = 0x00004000; + public const uint GL_HINT_BIT = 0x00008000; + public const uint GL_EVAL_BIT = 0x00010000; + public const uint GL_LIST_BIT = 0x00020000; + public const uint GL_TEXTURE_BIT = 0x00040000; + public const uint GL_SCISSOR_BIT = 0x00080000; + public const uint GL_ALL_ATTRIB_BITS = 0x000fffff; + + // BeginMode + + /// + /// Treats each vertex as a single point. Vertex n defines point n. N points are drawn. + /// + public const uint GL_POINTS = 0x0000; + + /// + /// Treats each pair of vertices as an independent line segment. Vertices 2n - 1 and 2n define line n. N/2 lines are drawn. + /// + public const uint GL_LINES = 0x0001; + + /// + /// Draws a connected group of line segments from the first vertex to the last, then back to the first. Vertices n and n + 1 define line n. The last line, however, is defined by vertices N and 1. N lines are drawn. + /// + public const uint GL_LINE_LOOP = 0x0002; + + /// + /// Draws a connected group of line segments from the first vertex to the last. Vertices n and n+1 define line n. N - 1 lines are drawn. + /// + public const uint GL_LINE_STRIP = 0x0003; + + /// + /// Treats each triplet of vertices as an independent triangle. Vertices 3n - 2, 3n - 1, and 3n define triangle n. N/3 triangles are drawn. + /// + public const uint GL_TRIANGLES = 0x0004; + + /// + /// Draws a connected group of triangles. One triangle is defined for each vertex presented after the first two vertices. For odd n, vertices n, n + 1, and n + 2 define triangle n. For even n, vertices n + 1, n, and n + 2 define triangle n. N - 2 triangles are drawn. + /// + public const uint GL_TRIANGLE_STRIP = 0x0005; + + /// + /// Draws a connected group of triangles. one triangle is defined for each vertex presented after the first two vertices. Vertices 1, n + 1, n + 2 define triangle n. N - 2 triangles are drawn. + /// + public const uint GL_TRIANGLE_FAN = 0x0006; + + /// + /// Treats each group of four vertices as an independent quadrilateral. Vertices 4n - 3, 4n - 2, 4n - 1, and 4n define quadrilateral n. N/4 quadrilaterals are drawn. + /// + public const uint GL_QUADS = 0x0007; + + /// + /// Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices 2n - 1, 2n, 2n + 2, and 2n + 1 define quadrilateral n. N/2 - 1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data. + /// + public const uint GL_QUAD_STRIP = 0x0008; + + /// + /// Draws a single, convex polygon. Vertices 1 through N define this polygon. + /// + public const uint GL_POLYGON = 0x0009; + + // BlendingFactorDest + public const uint GL_ZERO = 0; + public const uint GL_ONE = 1; + public const uint GL_SRC_COLOR = 0x0300; + public const uint GL_ONE_MINUS_SRC_COLOR = 0x0301; + public const uint GL_SRC_ALPHA = 0x0302; + public const uint GL_ONE_MINUS_SRC_ALPHA = 0x0303; + public const uint GL_DST_ALPHA = 0x0304; + public const uint GL_ONE_MINUS_DST_ALPHA = 0x0305; + + // BlendingFactorSrc + public const uint GL_DST_COLOR = 0x0306; + public const uint GL_ONE_MINUS_DST_COLOR = 0x0307; + public const uint GL_SRC_ALPHA_SATURATE = 0x0308; + + // Boolean + public const uint GL_TRUE = 1; + public const uint GL_FALSE = 0; + + // ClipPlaneName + public const uint GL_CLIP_PLANE0 = 0x3000; + public const uint GL_CLIP_PLANE1 = 0x3001; + public const uint GL_CLIP_PLANE2 = 0x3002; + public const uint GL_CLIP_PLANE3 = 0x3003; + public const uint GL_CLIP_PLANE4 = 0x3004; + public const uint GL_CLIP_PLANE5 = 0x3005; + + // DataType + public const uint GL_BYTE = 0x1400; + public const uint GL_UNSIGNED_BYTE = 0x1401; + public const uint GL_SHORT = 0x1402; + public const uint GL_UNSIGNED_SHORT = 0x1403; + public const uint GL_INT = 0x1404; + public const uint GL_UNSIGNED_INT = 0x1405; + public const uint GL_FLOAT = 0x1406; + public const uint GL_2_BYTES = 0x1407; + public const uint GL_3_BYTES = 0x1408; + public const uint GL_4_BYTES = 0x1409; + public const uint GL_DOUBLE = 0x140A; + + // DrawBufferMode + public const uint GL_NONE = 0; + public const uint GL_FRONT_LEFT = 0x0400; + public const uint GL_FRONT_RIGHT = 0x0401; + public const uint GL_BACK_LEFT = 0x0402; + public const uint GL_BACK_RIGHT = 0x0403; + public const uint GL_FRONT = 0x0404; + public const uint GL_BACK = 0x0405; + public const uint GL_LEFT = 0x0406; + public const uint GL_RIGHT = 0x0407; + public const uint GL_FRONT_AND_BACK = 0x0408; + public const uint GL_AUX0 = 0x0409; + public const uint GL_AUX1 = 0x040A; + public const uint GL_AUX2 = 0x040B; + public const uint GL_AUX3 = 0x040C; + + // ErrorCode + public const uint GL_NO_ERROR = 0; + public const uint GL_INVALID_ENUM = 0x0500; + public const uint GL_INVALID_VALUE = 0x0501; + public const uint GL_INVALID_OPERATION = 0x0502; + public const uint GL_STACK_OVERFLOW = 0x0503; + public const uint GL_STACK_UNDERFLOW = 0x0504; + public const uint GL_OUT_OF_MEMORY = 0x0505; + + // FeedBackMode + public const uint GL_2D = 0x0600; + public const uint GL_3D = 0x0601; + public const uint GL_4D_COLOR = 0x0602; + public const uint GL_3D_COLOR_TEXTURE = 0x0603; + public const uint GL_4D_COLOR_TEXTURE = 0x0604; + + // FeedBackToken + public const uint GL_PASS_THROUGH_TOKEN = 0x0700; + public const uint GL_POINT_TOKEN = 0x0701; + public const uint GL_LINE_TOKEN = 0x0702; + public const uint GL_POLYGON_TOKEN = 0x0703; + public const uint GL_BITMAP_TOKEN = 0x0704; + public const uint GL_DRAW_PIXEL_TOKEN = 0x0705; + public const uint GL_COPY_PIXEL_TOKEN = 0x0706; + public const uint GL_LINE_RESET_TOKEN = 0x0707; + + // FogMode + public const uint GL_EXP = 0x0800; + public const uint GL_EXP2 = 0x0801; + + // FrontFaceDirection + public const uint GL_CW = 0x0900; + public const uint GL_CCW = 0x0901; + + // GetMapTarget + public const uint GL_COEFF = 0x0A00; + public const uint GL_ORDER = 0x0A01; + public const uint GL_DOMAIN = 0x0A02; + + // GetTarget + public const uint GL_CURRENT_COLOR = 0x0B00; + public const uint GL_CURRENT_INDEX = 0x0B01; + public const uint GL_CURRENT_NORMAL = 0x0B02; + public const uint GL_CURRENT_TEXTURE_COORDS = 0x0B03; + public const uint GL_CURRENT_RASTER_COLOR = 0x0B04; + public const uint GL_CURRENT_RASTER_INDEX = 0x0B05; + public const uint GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06; + public const uint GL_CURRENT_RASTER_POSITION = 0x0B07; + public const uint GL_CURRENT_RASTER_POSITION_VALID = 0x0B08; + public const uint GL_CURRENT_RASTER_DISTANCE = 0x0B09; + public const uint GL_POINT_SMOOTH = 0x0B10; + public const uint GL_POINT_SIZE = 0x0B11; + public const uint GL_POINT_SIZE_RANGE = 0x0B12; + public const uint GL_POINT_SIZE_GRANULARITY = 0x0B13; + public const uint GL_LINE_SMOOTH = 0x0B20; + public const uint GL_LINE_WIDTH = 0x0B21; + public const uint GL_LINE_WIDTH_RANGE = 0x0B22; + public const uint GL_LINE_WIDTH_GRANULARITY = 0x0B23; + public const uint GL_LINE_STIPPLE = 0x0B24; + public const uint GL_LINE_STIPPLE_PATTERN = 0x0B25; + public const uint GL_LINE_STIPPLE_REPEAT = 0x0B26; + public const uint GL_LIST_MODE = 0x0B30; + public const uint GL_MAX_LIST_NESTING = 0x0B31; + public const uint GL_LIST_BASE = 0x0B32; + public const uint GL_LIST_INDEX = 0x0B33; + public const uint GL_POLYGON_MODE = 0x0B40; + public const uint GL_POLYGON_SMOOTH = 0x0B41; + public const uint GL_POLYGON_STIPPLE = 0x0B42; + public const uint GL_EDGE_FLAG = 0x0B43; + public const uint GL_CULL_FACE = 0x0B44; + public const uint GL_CULL_FACE_MODE = 0x0B45; + public const uint GL_FRONT_FACE = 0x0B46; + public const uint GL_LIGHTING = 0x0B50; + public const uint GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51; + public const uint GL_LIGHT_MODEL_TWO_SIDE = 0x0B52; + public const uint GL_LIGHT_MODEL_AMBIENT = 0x0B53; + public const uint GL_SHADE_MODEL = 0x0B54; + public const uint GL_COLOR_MATERIAL_FACE = 0x0B55; + public const uint GL_COLOR_MATERIAL_PARAMETER = 0x0B56; + public const uint GL_COLOR_MATERIAL = 0x0B57; + public const uint GL_FOG = 0x0B60; + public const uint GL_FOG_INDEX = 0x0B61; + public const uint GL_FOG_DENSITY = 0x0B62; + public const uint GL_FOG_START = 0x0B63; + public const uint GL_FOG_END = 0x0B64; + public const uint GL_FOG_MODE = 0x0B65; + public const uint GL_FOG_COLOR = 0x0B66; + public const uint GL_DEPTH_RANGE = 0x0B70; + public const uint GL_DEPTH_TEST = 0x0B71; + public const uint GL_DEPTH_WRITEMASK = 0x0B72; + public const uint GL_DEPTH_CLEAR_VALUE = 0x0B73; + public const uint GL_DEPTH_FUNC = 0x0B74; + public const uint GL_ACCUM_CLEAR_VALUE = 0x0B80; + public const uint GL_STENCIL_TEST = 0x0B90; + public const uint GL_STENCIL_CLEAR_VALUE = 0x0B91; + public const uint GL_STENCIL_FUNC = 0x0B92; + public const uint GL_STENCIL_VALUE_MASK = 0x0B93; + public const uint GL_STENCIL_FAIL = 0x0B94; + public const uint GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95; + public const uint GL_STENCIL_PASS_DEPTH_PASS = 0x0B96; + public const uint GL_STENCIL_REF = 0x0B97; + public const uint GL_STENCIL_WRITEMASK = 0x0B98; + public const uint GL_MATRIX_MODE = 0x0BA0; + public const uint GL_NORMALIZE = 0x0BA1; + public const uint GL_VIEWPORT = 0x0BA2; + public const uint GL_MODELVIEW_STACK_DEPTH = 0x0BA3; + public const uint GL_PROJECTION_STACK_DEPTH = 0x0BA4; + public const uint GL_TEXTURE_STACK_DEPTH = 0x0BA5; + public const uint GL_MODELVIEW_MATRIX = 0x0BA6; + public const uint GL_PROJECTION_MATRIX = 0x0BA7; + public const uint GL_TEXTURE_MATRIX = 0x0BA8; + public const uint GL_ATTRIB_STACK_DEPTH = 0x0BB0; + public const uint GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1; + public const uint GL_ALPHA_TEST = 0x0BC0; + public const uint GL_ALPHA_TEST_FUNC = 0x0BC1; + public const uint GL_ALPHA_TEST_REF = 0x0BC2; + public const uint GL_DITHER = 0x0BD0; + public const uint GL_BLEND_DST = 0x0BE0; + public const uint GL_BLEND_SRC = 0x0BE1; + public const uint GL_BLEND = 0x0BE2; + public const uint GL_LOGIC_OP_MODE = 0x0BF0; + public const uint GL_INDEX_LOGIC_OP = 0x0BF1; + public const uint GL_COLOR_LOGIC_OP = 0x0BF2; + public const uint GL_AUX_BUFFERS = 0x0C00; + public const uint GL_DRAW_BUFFER = 0x0C01; + public const uint GL_READ_BUFFER = 0x0C02; + public const uint GL_SCISSOR_BOX = 0x0C10; + public const uint GL_SCISSOR_TEST = 0x0C11; + public const uint GL_INDEX_CLEAR_VALUE = 0x0C20; + public const uint GL_INDEX_WRITEMASK = 0x0C21; + public const uint GL_COLOR_CLEAR_VALUE = 0x0C22; + public const uint GL_COLOR_WRITEMASK = 0x0C23; + public const uint GL_INDEX_MODE = 0x0C30; + public const uint GL_RGBA_MODE = 0x0C31; + public const uint GL_DOUBLEBUFFER = 0x0C32; + public const uint GL_STEREO = 0x0C33; + public const uint GL_RENDER_MODE = 0x0C40; + public const uint GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50; + public const uint GL_POINT_SMOOTH_HINT = 0x0C51; + public const uint GL_LINE_SMOOTH_HINT = 0x0C52; + public const uint GL_POLYGON_SMOOTH_HINT = 0x0C53; + public const uint GL_FOG_HINT = 0x0C54; + public const uint GL_TEXTURE_GEN_S = 0x0C60; + public const uint GL_TEXTURE_GEN_T = 0x0C61; + public const uint GL_TEXTURE_GEN_R = 0x0C62; + public const uint GL_TEXTURE_GEN_Q = 0x0C63; + public const uint GL_PIXEL_MAP_I_TO_I = 0x0C70; + public const uint GL_PIXEL_MAP_S_TO_S = 0x0C71; + public const uint GL_PIXEL_MAP_I_TO_R = 0x0C72; + public const uint GL_PIXEL_MAP_I_TO_G = 0x0C73; + public const uint GL_PIXEL_MAP_I_TO_B = 0x0C74; + public const uint GL_PIXEL_MAP_I_TO_A = 0x0C75; + public const uint GL_PIXEL_MAP_R_TO_R = 0x0C76; + public const uint GL_PIXEL_MAP_G_TO_G = 0x0C77; + public const uint GL_PIXEL_MAP_B_TO_B = 0x0C78; + public const uint GL_PIXEL_MAP_A_TO_A = 0x0C79; + public const uint GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0; + public const uint GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1; + public const uint GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2; + public const uint GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3; + public const uint GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4; + public const uint GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5; + public const uint GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6; + public const uint GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7; + public const uint GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8; + public const uint GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9; + public const uint GL_UNPACK_SWAP_BYTES = 0x0CF0; + public const uint GL_UNPACK_LSB_FIRST = 0x0CF1; + public const uint GL_UNPACK_ROW_LENGTH = 0x0CF2; + public const uint GL_UNPACK_SKIP_ROWS = 0x0CF3; + public const uint GL_UNPACK_SKIP_PIXELS = 0x0CF4; + public const uint GL_UNPACK_ALIGNMENT = 0x0CF5; + public const uint GL_PACK_SWAP_BYTES = 0x0D00; + public const uint GL_PACK_LSB_FIRST = 0x0D01; + public const uint GL_PACK_ROW_LENGTH = 0x0D02; + public const uint GL_PACK_SKIP_ROWS = 0x0D03; + public const uint GL_PACK_SKIP_PIXELS = 0x0D04; + public const uint GL_PACK_ALIGNMENT = 0x0D05; + public const uint GL_MAP_COLOR = 0x0D10; + public const uint GL_MAP_STENCIL = 0x0D11; + public const uint GL_INDEX_SHIFT = 0x0D12; + public const uint GL_INDEX_OFFSET = 0x0D13; + public const uint GL_RED_SCALE = 0x0D14; + public const uint GL_RED_BIAS = 0x0D15; + public const uint GL_ZOOM_X = 0x0D16; + public const uint GL_ZOOM_Y = 0x0D17; + public const uint GL_GREEN_SCALE = 0x0D18; + public const uint GL_GREEN_BIAS = 0x0D19; + public const uint GL_BLUE_SCALE = 0x0D1A; + public const uint GL_BLUE_BIAS = 0x0D1B; + public const uint GL_ALPHA_SCALE = 0x0D1C; + public const uint GL_ALPHA_BIAS = 0x0D1D; + public const uint GL_DEPTH_SCALE = 0x0D1E; + public const uint GL_DEPTH_BIAS = 0x0D1F; + public const uint GL_MAX_EVAL_ORDER = 0x0D30; + public const uint GL_MAX_LIGHTS = 0x0D31; + public const uint GL_MAX_CLIP_PLANES = 0x0D32; + public const uint GL_MAX_TEXTURE_SIZE = 0x0D33; + public const uint GL_MAX_PIXEL_MAP_TABLE = 0x0D34; + public const uint GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35; + public const uint GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36; + public const uint GL_MAX_NAME_STACK_DEPTH = 0x0D37; + public const uint GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38; + public const uint GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39; + public const uint GL_MAX_VIEWPORT_DIMS = 0x0D3A; + public const uint GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B; + public const uint GL_SUBPIXEL_BITS = 0x0D50; + public const uint GL_INDEX_BITS = 0x0D51; + public const uint GL_RED_BITS = 0x0D52; + public const uint GL_GREEN_BITS = 0x0D53; + public const uint GL_BLUE_BITS = 0x0D54; + public const uint GL_ALPHA_BITS = 0x0D55; + public const uint GL_DEPTH_BITS = 0x0D56; + public const uint GL_STENCIL_BITS = 0x0D57; + public const uint GL_ACCUM_RED_BITS = 0x0D58; + public const uint GL_ACCUM_GREEN_BITS = 0x0D59; + public const uint GL_ACCUM_BLUE_BITS = 0x0D5A; + public const uint GL_ACCUM_ALPHA_BITS = 0x0D5B; + public const uint GL_NAME_STACK_DEPTH = 0x0D70; + public const uint GL_AUTO_NORMAL = 0x0D80; + public const uint GL_MAP1_COLOR_4 = 0x0D90; + public const uint GL_MAP1_INDEX = 0x0D91; + public const uint GL_MAP1_NORMAL = 0x0D92; + public const uint GL_MAP1_TEXTURE_COORD_1 = 0x0D93; + public const uint GL_MAP1_TEXTURE_COORD_2 = 0x0D94; + public const uint GL_MAP1_TEXTURE_COORD_3 = 0x0D95; + public const uint GL_MAP1_TEXTURE_COORD_4 = 0x0D96; + public const uint GL_MAP1_VERTEX_3 = 0x0D97; + public const uint GL_MAP1_VERTEX_4 = 0x0D98; + public const uint GL_MAP2_COLOR_4 = 0x0DB0; + public const uint GL_MAP2_INDEX = 0x0DB1; + public const uint GL_MAP2_NORMAL = 0x0DB2; + public const uint GL_MAP2_TEXTURE_COORD_1 = 0x0DB3; + public const uint GL_MAP2_TEXTURE_COORD_2 = 0x0DB4; + public const uint GL_MAP2_TEXTURE_COORD_3 = 0x0DB5; + public const uint GL_MAP2_TEXTURE_COORD_4 = 0x0DB6; + public const uint GL_MAP2_VERTEX_3 = 0x0DB7; + public const uint GL_MAP2_VERTEX_4 = 0x0DB8; + public const uint GL_MAP1_GRID_DOMAIN = 0x0DD0; + public const uint GL_MAP1_GRID_SEGMENTS = 0x0DD1; + public const uint GL_MAP2_GRID_DOMAIN = 0x0DD2; + public const uint GL_MAP2_GRID_SEGMENTS = 0x0DD3; + public const uint GL_TEXTURE_1D = 0x0DE0; + public const uint GL_TEXTURE_2D = 0x0DE1; + public const uint GL_FEEDBACK_BUFFER_POINTER = 0x0DF0; + public const uint GL_FEEDBACK_BUFFER_SIZE = 0x0DF1; + public const uint GL_FEEDBACK_BUFFER_TYPE = 0x0DF2; + public const uint GL_SELECTION_BUFFER_POINTER = 0x0DF3; + public const uint GL_SELECTION_BUFFER_SIZE = 0x0DF4; + + // GetTextureParameter + public const uint GL_TEXTURE_WIDTH = 0x1000; + public const uint GL_TEXTURE_HEIGHT = 0x1001; + public const uint GL_TEXTURE_INTERNAL_FORMAT = 0x1003; + public const uint GL_TEXTURE_BORDER_COLOR = 0x1004; + public const uint GL_TEXTURE_BORDER = 0x1005; + + // HintMode + public const uint GL_DONT_CARE = 0x1100; + public const uint GL_FASTEST = 0x1101; + public const uint GL_NICEST = 0x1102; + + // LightName + public const uint GL_LIGHT0 = 0x4000; + public const uint GL_LIGHT1 = 0x4001; + public const uint GL_LIGHT2 = 0x4002; + public const uint GL_LIGHT3 = 0x4003; + public const uint GL_LIGHT4 = 0x4004; + public const uint GL_LIGHT5 = 0x4005; + public const uint GL_LIGHT6 = 0x4006; + public const uint GL_LIGHT7 = 0x4007; + + // LightParameter + public const uint GL_AMBIENT = 0x1200; + public const uint GL_DIFFUSE = 0x1201; + public const uint GL_SPECULAR = 0x1202; + public const uint GL_POSITION = 0x1203; + public const uint GL_SPOT_DIRECTION = 0x1204; + public const uint GL_SPOT_EXPONENT = 0x1205; + public const uint GL_SPOT_CUTOFF = 0x1206; + public const uint GL_CONSTANT_ATTENUATION = 0x1207; + public const uint GL_LINEAR_ATTENUATION = 0x1208; + public const uint GL_QUADRATIC_ATTENUATION = 0x1209; + + // ListMode + public const uint GL_COMPILE = 0x1300; + public const uint GL_COMPILE_AND_EXECUTE = 0x1301; + + // LogicOp + public const uint GL_CLEAR = 0x1500; + public const uint GL_AND = 0x1501; + public const uint GL_AND_REVERSE = 0x1502; + public const uint GL_COPY = 0x1503; + public const uint GL_AND_INVERTED = 0x1504; + public const uint GL_NOOP = 0x1505; + public const uint GL_XOR = 0x1506; + public const uint GL_OR = 0x1507; + public const uint GL_NOR = 0x1508; + public const uint GL_EQUIV = 0x1509; + public const uint GL_INVERT = 0x150A; + public const uint GL_OR_REVERSE = 0x150B; + public const uint GL_COPY_INVERTED = 0x150C; + public const uint GL_OR_INVERTED = 0x150D; + public const uint GL_NAND = 0x150E; + public const uint GL_SET = 0x150F; + + // MaterialParameter + public const uint GL_EMISSION = 0x1600; + public const uint GL_SHININESS = 0x1601; + public const uint GL_AMBIENT_AND_DIFFUSE = 0x1602; + public const uint GL_COLOR_INDEXES = 0x1603; + + // MatrixMode + public const uint GL_MODELVIEW = 0x1700; + public const uint GL_PROJECTION = 0x1701; + public const uint GL_TEXTURE = 0x1702; + + // PixelCopyType + public const uint GL_COLOR = 0x1800; + public const uint GL_DEPTH = 0x1801; + public const uint GL_STENCIL = 0x1802; + + // PixelFormat + public const uint GL_COLOR_INDEX = 0x1900; + public const uint GL_STENCIL_INDEX = 0x1901; + public const uint GL_DEPTH_COMPONENT = 0x1902; + public const uint GL_RED = 0x1903; + public const uint GL_GREEN = 0x1904; + public const uint GL_BLUE = 0x1905; + public const uint GL_ALPHA = 0x1906; + public const uint GL_RGB = 0x1907; + public const uint GL_RGBA = 0x1908; + public const uint GL_LUMINANCE = 0x1909; + public const uint GL_LUMINANCE_ALPHA = 0x190A; + + // PixelType + public const uint GL_BITMAP = 0x1A00; + + // PolygonMode + public const uint GL_POINT = 0x1B00; + public const uint GL_LINE = 0x1B01; + public const uint GL_FILL = 0x1B02; + + // RenderingMode + public const uint GL_RENDER = 0x1C00; + public const uint GL_FEEDBACK = 0x1C01; + public const uint GL_SELECT = 0x1C02; + + // ShadingModel + public const uint GL_FLAT = 0x1D00; + public const uint GL_SMOOTH = 0x1D01; + + // StencilOp + public const uint GL_KEEP = 0x1E00; + public const uint GL_REPLACE = 0x1E01; + public const uint GL_INCR = 0x1E02; + public const uint GL_DECR = 0x1E03; + + // StringName + public const uint GL_VENDOR = 0x1F00; + public const uint GL_RENDERER = 0x1F01; + public const uint GL_VERSION = 0x1F02; + public const uint GL_EXTENSIONS = 0x1F03; + + // TextureCoordName + public const uint GL_S = 0x2000; + public const uint GL_T = 0x2001; + public const uint GL_R = 0x2002; + public const uint GL_Q = 0x2003; + + // TextureEnvMode + public const uint GL_MODULATE = 0x2100; + public const uint GL_DECAL = 0x2101; + + // TextureEnvParameter + public const uint GL_TEXTURE_ENV_MODE = 0x2200; + public const uint GL_TEXTURE_ENV_COLOR = 0x2201; + + // TextureEnvTarget + public const uint GL_TEXTURE_ENV = 0x2300; + + // TextureGenMode + public const uint GL_EYE_LINEAR = 0x2400; + public const uint GL_OBJECT_LINEAR = 0x2401; + public const uint GL_SPHERE_MAP = 0x2402; + + // TextureGenParameter + public const uint GL_TEXTURE_GEN_MODE = 0x2500; + public const uint GL_OBJECT_PLANE = 0x2501; + public const uint GL_EYE_PLANE = 0x2502; + + // TextureMagFilter + public const uint GL_NEAREST = 0x2600; + public const uint GL_LINEAR = 0x2601; + + // TextureMinFilter + public const uint GL_NEAREST_MIPMAP_NEAREST = 0x2700; + public const uint GL_LINEAR_MIPMAP_NEAREST = 0x2701; + public const uint GL_NEAREST_MIPMAP_LINEAR = 0x2702; + public const uint GL_LINEAR_MIPMAP_LINEAR = 0x2703; + + // TextureParameterName + public const uint GL_TEXTURE_MAG_FILTER = 0x2800; + public const uint GL_TEXTURE_MIN_FILTER = 0x2801; + public const uint GL_TEXTURE_WRAP_S = 0x2802; + public const uint GL_TEXTURE_WRAP_T = 0x2803; + + // TextureWrapMode + public const uint GL_CLAMP = 0x2900; + public const uint GL_REPEAT = 0x2901; + + // ClientAttribMask + public const uint GL_CLIENT_PIXEL_STORE_BIT = 0x00000001; + public const uint GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002; + public const uint GL_CLIENT_ALL_ATTRIB_BITS = 0xffffffff; + + // Polygon Offset + public const uint GL_POLYGON_OFFSET_FACTOR = 0x8038; + public const uint GL_POLYGON_OFFSET_UNITS = 0x2A00; + public const uint GL_POLYGON_OFFSET_POINT = 0x2A01; + public const uint GL_POLYGON_OFFSET_LINE = 0x2A02; + public const uint GL_POLYGON_OFFSET_FILL = 0x8037; + + // Texture + public const uint GL_ALPHA4 = 0x803B; + public const uint GL_ALPHA8 = 0x803C; + public const uint GL_ALPHA12 = 0x803D; + public const uint GL_ALPHA16 = 0x803E; + public const uint GL_LUMINANCE4 = 0x803F; + public const uint GL_LUMINANCE8 = 0x8040; + public const uint GL_LUMINANCE12 = 0x8041; + public const uint GL_LUMINANCE16 = 0x8042; + public const uint GL_LUMINANCE4_ALPHA4 = 0x8043; + public const uint GL_LUMINANCE6_ALPHA2 = 0x8044; + public const uint GL_LUMINANCE8_ALPHA8 = 0x8045; + public const uint GL_LUMINANCE12_ALPHA4 = 0x8046; + public const uint GL_LUMINANCE12_ALPHA12 = 0x8047; + public const uint GL_LUMINANCE16_ALPHA16 = 0x8048; + public const uint GL_INTENSITY = 0x8049; + public const uint GL_INTENSITY4 = 0x804A; + public const uint GL_INTENSITY8 = 0x804B; + public const uint GL_INTENSITY12 = 0x804C; + public const uint GL_INTENSITY16 = 0x804D; + public const uint GL_R3_G3_B2 = 0x2A10; + public const uint GL_RGB4 = 0x804F; + public const uint GL_RGB5 = 0x8050; + public const uint GL_RGB8 = 0x8051; + public const uint GL_RGB10 = 0x8052; + public const uint GL_RGB12 = 0x8053; + public const uint GL_RGB16 = 0x8054; + public const uint GL_RGBA2 = 0x8055; + public const uint GL_RGBA4 = 0x8056; + public const uint GL_RGB5_A1 = 0x8057; + public const uint GL_RGBA8 = 0x8058; + public const uint GL_RGB10_A2 = 0x8059; + public const uint GL_RGBA12 = 0x805A; + public const uint GL_RGBA16 = 0x805B; + public const uint GL_TEXTURE_RED_SIZE = 0x805C; + public const uint GL_TEXTURE_GREEN_SIZE = 0x805D; + public const uint GL_TEXTURE_BLUE_SIZE = 0x805E; + public const uint GL_TEXTURE_ALPHA_SIZE = 0x805F; + public const uint GL_TEXTURE_LUMINANCE_SIZE = 0x8060; + public const uint GL_TEXTURE_INTENSITY_SIZE = 0x8061; + public const uint GL_PROXY_TEXTURE_1D = 0x8063; + public const uint GL_PROXY_TEXTURE_2D = 0x8064; + + // Texture object + public const uint GL_TEXTURE_PRIORITY = 0x8066; + public const uint GL_TEXTURE_RESIDENT = 0x8067; + public const uint GL_TEXTURE_BINDING_1D = 0x8068; + public const uint GL_TEXTURE_BINDING_2D = 0x8069; + + // Vertex array + public const uint GL_VERTEX_ARRAY = 0x8074; + public const uint GL_NORMAL_ARRAY = 0x8075; + public const uint GL_COLOR_ARRAY = 0x8076; + public const uint GL_INDEX_ARRAY = 0x8077; + public const uint GL_TEXTURE_COORD_ARRAY = 0x8078; + public const uint GL_EDGE_FLAG_ARRAY = 0x8079; + public const uint GL_VERTEX_ARRAY_SIZE = 0x807A; + public const uint GL_VERTEX_ARRAY_TYPE = 0x807B; + public const uint GL_VERTEX_ARRAY_STRIDE = 0x807C; + public const uint GL_NORMAL_ARRAY_TYPE = 0x807E; + public const uint GL_NORMAL_ARRAY_STRIDE = 0x807F; + public const uint GL_COLOR_ARRAY_SIZE = 0x8081; + public const uint GL_COLOR_ARRAY_TYPE = 0x8082; + public const uint GL_COLOR_ARRAY_STRIDE = 0x8083; + public const uint GL_INDEX_ARRAY_TYPE = 0x8085; + public const uint GL_INDEX_ARRAY_STRIDE = 0x8086; + public const uint GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088; + public const uint GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089; + public const uint GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A; + public const uint GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C; + public const uint GL_VERTEX_ARRAY_POINTER = 0x808E; + public const uint GL_NORMAL_ARRAY_POINTER = 0x808F; + public const uint GL_COLOR_ARRAY_POINTER = 0x8090; + public const uint GL_INDEX_ARRAY_POINTER = 0x8091; + public const uint GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092; + public const uint GL_EDGE_FLAG_ARRAY_POINTER = 0x8093; + public const uint GL_V2F = 0x2A20; + public const uint GL_V3F = 0x2A21; + public const uint GL_C4UB_V2F = 0x2A22; + public const uint GL_C4UB_V3F = 0x2A23; + public const uint GL_C3F_V3F = 0x2A24; + public const uint GL_N3F_V3F = 0x2A25; + public const uint GL_C4F_N3F_V3F = 0x2A26; + public const uint GL_T2F_V3F = 0x2A27; + public const uint GL_T4F_V4F = 0x2A28; + public const uint GL_T2F_C4UB_V3F = 0x2A29; + public const uint GL_T2F_C3F_V3F = 0x2A2A; + public const uint GL_T2F_N3F_V3F = 0x2A2B; + public const uint GL_T2F_C4F_N3F_V3F = 0x2A2C; + public const uint GL_T4F_C4F_N3F_V4F = 0x2A2D; + + // Extensions + public const uint GL_EXT_vertex_array = 1; + public const uint GL_EXT_bgra = 1; + public const uint GL_EXT_paletted_texture = 1; + public const uint GL_WIN_swap_hint = 1; + public const uint GL_WIN_draw_range_elements = 1; + + // EXT_vertex_array + public const uint GL_VERTEX_ARRAY_EXT = 0x8074; + public const uint GL_NORMAL_ARRAY_EXT = 0x8075; + public const uint GL_COLOR_ARRAY_EXT = 0x8076; + public const uint GL_INDEX_ARRAY_EXT = 0x8077; + public const uint GL_TEXTURE_COORD_ARRAY_EXT = 0x8078; + public const uint GL_EDGE_FLAG_ARRAY_EXT = 0x8079; + public const uint GL_VERTEX_ARRAY_SIZE_EXT = 0x807A; + public const uint GL_VERTEX_ARRAY_TYPE_EXT = 0x807B; + public const uint GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C; + public const uint GL_VERTEX_ARRAY_COUNT_EXT = 0x807D; + public const uint GL_NORMAL_ARRAY_TYPE_EXT = 0x807E; + public const uint GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F; + public const uint GL_NORMAL_ARRAY_COUNT_EXT = 0x8080; + public const uint GL_COLOR_ARRAY_SIZE_EXT = 0x8081; + public const uint GL_COLOR_ARRAY_TYPE_EXT = 0x8082; + public const uint GL_COLOR_ARRAY_STRIDE_EXT = 0x8083; + public const uint GL_COLOR_ARRAY_COUNT_EXT = 0x8084; + public const uint GL_INDEX_ARRAY_TYPE_EXT = 0x8085; + public const uint GL_INDEX_ARRAY_STRIDE_EXT = 0x8086; + public const uint GL_INDEX_ARRAY_COUNT_EXT = 0x8087; + public const uint GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088; + public const uint GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089; + public const uint GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A; + public const uint GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B; + public const uint GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C; + public const uint GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D; + public const uint GL_VERTEX_ARRAY_POINTER_EXT = 0x808E; + public const uint GL_NORMAL_ARRAY_POINTER_EXT = 0x808F; + public const uint GL_COLOR_ARRAY_POINTER_EXT = 0x8090; + public const uint GL_INDEX_ARRAY_POINTER_EXT = 0x8091; + public const uint GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092; + public const uint GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093; + public const uint GL_DOUBLE_EXT =1;/*DOUBLE*/ + + // EXT_paletted_texture + public const uint GL_COLOR_TABLE_FORMAT_EXT = 0x80D8; + public const uint GL_COLOR_TABLE_WIDTH_EXT = 0x80D9; + public const uint GL_COLOR_TABLE_RED_SIZE_EXT = 0x80DA; + public const uint GL_COLOR_TABLE_GREEN_SIZE_EXT = 0x80DB; + public const uint GL_COLOR_TABLE_BLUE_SIZE_EXT = 0x80DC; + public const uint GL_COLOR_TABLE_ALPHA_SIZE_EXT = 0x80DD; + public const uint GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = 0x80DE; + public const uint GL_COLOR_TABLE_INTENSITY_SIZE_EXT = 0x80DF; + public const uint GL_COLOR_INDEX1_EXT = 0x80E2; + public const uint GL_COLOR_INDEX2_EXT = 0x80E3; + public const uint GL_COLOR_INDEX4_EXT = 0x80E4; + public const uint GL_COLOR_INDEX8_EXT = 0x80E5; + public const uint GL_COLOR_INDEX12_EXT = 0x80E6; + public const uint GL_COLOR_INDEX16_EXT = 0x80E7; + + // WIN_draw_range_elements + public const uint GL_MAX_ELEMENTS_VERTICES_WIN = 0x80E8; + public const uint GL_MAX_ELEMENTS_INDICES_WIN = 0x80E9; + + // WIN_phong_shading + public const uint GL_PHONG_WIN = 0x80EA; + public const uint GL_PHONG_HINT_WIN = 0x80EB; + + + // WIN_specular_fog + public uint FOG_SPECULAR_TEXTURE_WIN = 0x80EC; + + #endregion + + #region The GLU DLL Constant Definitions. + + // Version + public const uint GLU_VERSION_1_1 = 1; + public const uint GLU_VERSION_1_2 = 1; + + // Errors: (return value 0 = no error) + public const uint GLU_INVALID_ENUM = 100900; + public const uint GLU_INVALID_VALUE = 100901; + public const uint GLU_OUT_OF_MEMORY = 100902; + public const uint GLU_INCOMPATIBLE_GL_VERSION = 100903; + + // StringName + public const uint GLU_VERSION = 100800; + public const uint GLU_EXTENSIONS = 100801; + + // Boolean + public const uint GLU_TRUE = 1; + public const uint GLU_FALSE = 0; + + // Quadric constants + + // QuadricNormal + public const uint GLU_SMOOTH = 100000; + public const uint GLU_FLAT = 100001; + public const uint GLU_NONE = 100002; + + // QuadricDrawStyle + public const uint GLU_POINT = 100010; + public const uint GLU_LINE = 100011; + public const uint GLU_FILL = 100012; + public const uint GLU_SILHOUETTE = 100013; + + // QuadricOrientation + public const uint GLU_OUTSIDE = 100020; + public const uint GLU_INSIDE = 100021; + + // Tesselation constants + public const double GLU_TESS_MAX_COORD = 1.0e150; + + // TessProperty + public const uint GLU_TESS_WINDING_RULE =100140; + public const uint GLU_TESS_BOUNDARY_ONLY =100141; + public const uint GLU_TESS_TOLERANCE =100142; + + // TessWinding + public const uint GLU_TESS_WINDING_ODD =100130; + public const uint GLU_TESS_WINDING_NONZERO =100131; + public const uint GLU_TESS_WINDING_POSITIVE =100132; + public const uint GLU_TESS_WINDING_NEGATIVE =100133; + public const uint GLU_TESS_WINDING_ABS_GEQ_TWO =100134; + + // TessCallback + public const uint GLU_TESS_BEGIN =100100; + public const uint GLU_TESS_VERTEX =100101; + public const uint GLU_TESS_END =100102; + public const uint GLU_TESS_ERROR =100103; + public const uint GLU_TESS_EDGE_FLAG =100104; + public const uint GLU_TESS_COMBINE =100105; + public const uint GLU_TESS_BEGIN_DATA =100106; + public const uint GLU_TESS_VERTEX_DATA =100107; + public const uint GLU_TESS_END_DATA =100108; + public const uint GLU_TESS_ERROR_DATA =100109; + public const uint GLU_TESS_EDGE_FLAG_DATA =100110; + public const uint GLU_TESS_COMBINE_DATA =100111; + + // TessError + public const uint GLU_TESS_ERROR1 =100151; + public const uint GLU_TESS_ERROR2 =100152; + public const uint GLU_TESS_ERROR3 =100153; + public const uint GLU_TESS_ERROR4 =100154; + public const uint GLU_TESS_ERROR5 =100155; + public const uint GLU_TESS_ERROR6 =100156; + public const uint GLU_TESS_ERROR7 =100157; + public const uint GLU_TESS_ERROR8 =100158; + + public const uint GLU_TESS_MISSING_BEGIN_POLYGON =100151; + public const uint GLU_TESS_MISSING_BEGIN_CONTOUR =100152; + public const uint GLU_TESS_MISSING_END_POLYGON =100153; + public const uint GLU_TESS_MISSING_END_CONTOUR =100154; + public const uint GLU_TESS_COORD_TOO_LARGE =100155; + public const uint GLU_TESS_NEED_COMBINE_CALLBACK =100156; + + // NURBS constants + + // NurbsProperty + public const uint GLU_AUTO_LOAD_MATRIX =100200; + public const uint GLU_CULLING =100201; + public const uint GLU_SAMPLING_TOLERANCE =100203; + public const uint GLU_DISPLAY_MODE =100204; + public const uint GLU_PARAMETRIC_TOLERANCE =100202; + public const uint GLU_SAMPLING_METHOD =100205; + public const uint GLU_U_STEP =100206; + public const uint GLU_V_STEP =100207; + + // NurbsSampling + public const uint GLU_PATH_LENGTH =100215; + public const uint GLU_PARAMETRIC_ERROR =100216; + public const uint GLU_DOMAIN_DISTANCE =100217; + + + // NurbsTrim + public const uint GLU_MAP1_TRIM_2 =100210; + public const uint GLU_MAP1_TRIM_3 =100211; + + // NurbsDisplay + // GLU_FILL 100012 + public const uint GLU_OUTLINE_POLYGON =100240; + public const uint GLU_OUTLINE_PATCH =100241; + + // NurbsCallback + // GLU_ERROR 100103 + + // NurbsErrors + public const uint GLU_NURBS_ERROR1 =100251; + public const uint GLU_NURBS_ERROR2 =100252; + public const uint GLU_NURBS_ERROR3 =100253; + public const uint GLU_NURBS_ERROR4 =100254; + public const uint GLU_NURBS_ERROR5 =100255; + public const uint GLU_NURBS_ERROR6 =100256; + public const uint GLU_NURBS_ERROR7 =100257; + public const uint GLU_NURBS_ERROR8 =100258; + public const uint GLU_NURBS_ERROR9 =100259; + public const uint GLU_NURBS_ERROR10 =100260; + public const uint GLU_NURBS_ERROR11 =100261; + public const uint GLU_NURBS_ERROR12 =100262; + public const uint GLU_NURBS_ERROR13 =100263; + public const uint GLU_NURBS_ERROR14 =100264; + public const uint GLU_NURBS_ERROR15 =100265; + public const uint GLU_NURBS_ERROR16 =100266; + public const uint GLU_NURBS_ERROR17 =100267; + public const uint GLU_NURBS_ERROR18 =100268; + public const uint GLU_NURBS_ERROR19 =100269; + public const uint GLU_NURBS_ERROR20 =100270; + public const uint GLU_NURBS_ERROR21 =100271; + public const uint GLU_NURBS_ERROR22 =100272; + public const uint GLU_NURBS_ERROR23 =100273; + public const uint GLU_NURBS_ERROR24 =100274; + public const uint GLU_NURBS_ERROR25 =100275; + public const uint GLU_NURBS_ERROR26 =100276; + public const uint GLU_NURBS_ERROR27 =100277; + public const uint GLU_NURBS_ERROR28 =100278; + public const uint GLU_NURBS_ERROR29 =100279; + public const uint GLU_NURBS_ERROR30 =100280; + public const uint GLU_NURBS_ERROR31 =100281; + public const uint GLU_NURBS_ERROR32 =100282; + public const uint GLU_NURBS_ERROR33 =100283; + public const uint GLU_NURBS_ERROR34 =100284; + public const uint GLU_NURBS_ERROR35 =100285; + public const uint GLU_NURBS_ERROR36 =100286; + public const uint GLU_NURBS_ERROR37 =100287; + + #endregion + + #region The OpenGL DLL Functions (Exactly the same naming). + + public const string LIBRARY_OPENGL = "opengl32.dll"; + + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glAccum(uint op, float value); + + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glAlphaFunc (uint func, float ref_notkeword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern byte glAreTexturesResident (int n, uint []textures, byte []residences); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glArrayElement (int i); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glBegin (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glBindTexture (uint target, uint texture); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glBitmap (int width, int height, float xorig, float yorig, float xmove, float ymove, byte []bitmap); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glBlendFunc (uint sfactor, uint dfactor); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCallList (uint list); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCallLists (int n, uint type, IntPtr lists); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCallLists (int n, uint type, uint[] lists); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCallLists (int n, uint type, byte[] lists); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClear (uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClearAccum (float red, float green, float blue, float alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClearColor (float red, float green, float blue, float alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClearDepth (double depth); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClearIndex (float c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClearStencil (int s); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glClipPlane (uint plane, double []equation); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3b (byte red, byte green, byte blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3bv ( byte []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3d (double red, double green, double blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3f (float red, float green, float blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3i (int red, int green, int blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3s (short red, short green, short blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3ub (byte red, byte green, byte blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3ubv ( byte []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3ui (uint red, uint green, uint blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3uiv ( uint []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3us (ushort red, ushort green, ushort blue); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor3usv ( ushort []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4b (byte red, byte green, byte blue, byte alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4bv ( byte []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4d (double red, double green, double blue, double alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4f (float red, float green, float blue, float alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4i (int red, int green, int blue, int alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4s (short red, short green, short blue, short alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4ub (byte red, byte green, byte blue, byte alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4ubv ( byte []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4ui (uint red, uint green, uint blue, uint alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4uiv ( uint []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4us (ushort red, ushort green, ushort blue, ushort alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColor4usv ( ushort []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColorMask (byte red, byte green, byte blue, byte alpha); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColorMaterial (uint face, uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glColorPointer (int size, uint type, int stride, IntPtr pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCopyPixels (int x, int y, int width, int height, uint type); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCopyTexImage1D (uint target, int level, uint internalFormat, int x, int y, int width, int border); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCopyTexImage2D (uint target, int level, uint internalFormat, int x, int y, int width, int height, int border); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCopyTexSubImage1D (uint target, int level, int xoffset, int x, int y, int width); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCopyTexSubImage2D (uint target, int level, int xoffset, int yoffset, int x, int y, int width, int height); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glCullFace (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDeleteLists (uint list, int range); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDeleteTextures (int n, uint []textures); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDepthFunc (uint func); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDepthMask (byte flag); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDepthRange (double zNear, double zFar); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDisable (uint cap); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDisableClientState (uint array); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawArrays (uint mode, int first, int count); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawBuffer (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawElements(uint mode, int count, uint type, IntPtr indices); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawElements(uint mode, int count, uint type, uint[] indices); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawPixels(int width, int height, uint format, uint type, float[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawPixels(int width, int height, uint format, uint type, uint[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawPixels(int width, int height, uint format, uint type, ushort[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawPixels(int width, int height, uint format, uint type, byte[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glDrawPixels(int width, int height, uint format, uint type, IntPtr pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEdgeFlag (byte flag); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEdgeFlagPointer (int stride, int[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEdgeFlagv ( byte []flag); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEnable (uint cap); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEnableClientState (uint array); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEnd (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEndList (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord1d (double u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord1dv ( double []u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord1f (float u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord1fv ( float []u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord2d (double u, double v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord2dv ( double []u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord2f (float u, float v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalCoord2fv ( float []u); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalMesh1 (uint mode, int i1, int i2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalMesh2 (uint mode, int i1, int i2, int j1, int j2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalPoint1 (int i); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glEvalPoint2 (int i, int j); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFeedbackBuffer (int size, uint type, float []buffer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFinish (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFlush (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFogf (uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFogfv (uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFogi (uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFogiv (uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFrontFace (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glFrustum (double left, double right, double bottom, double top, double zNear, double zFar); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern uint glGenLists (int range); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGenTextures (int n, uint []textures); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetBooleanv (uint pname, byte []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetClipPlane (uint plane, double []equation); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetDoublev (uint pname, double []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern uint glGetError (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetFloatv (uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetIntegerv (uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetLightfv (uint light, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetLightiv (uint light, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetMapdv (uint target, uint query, double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetMapfv (uint target, uint query, float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetMapiv (uint target, uint query, int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetMaterialfv (uint face, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetMaterialiv (uint face, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetPixelMapfv (uint map, float []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetPixelMapuiv (uint map, uint []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetPixelMapusv (uint map, ushort []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetPointerv (uint pname, int[] params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetPolygonStipple (byte []mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private unsafe static extern sbyte* glGetString (uint name); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexEnvfv (uint target, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexEnviv (uint target, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexGendv (uint coord, uint pname, double []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexGenfv (uint coord, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexGeniv (uint coord, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexImage (uint target, int level, uint format, uint type, int []pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexLevelParameterfv (uint target, int level, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexLevelParameteriv (uint target, int level, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexParameterfv (uint target, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glGetTexParameteriv (uint target, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glHint (uint target, uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexMask (uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexPointer (uint type, int stride, int[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexd (double c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexdv ( double []c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexf (float c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexfv ( float []c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexi (int c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexiv ( int []c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexs (short c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexsv ( short []c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexub (byte c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glIndexubv ( byte []c); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glInitNames (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glInterleavedArrays (uint format, int stride, int[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern byte glIsEnabled (uint cap); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern byte glIsList (uint list); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern byte glIsTexture (uint texture); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightModelf (uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightModelfv (uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightModeli (uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightModeliv (uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightf (uint light, uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightfv (uint light, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLighti (uint light, uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLightiv (uint light, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLineStipple (int factor, ushort pattern); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLineWidth (float width); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glListBase (uint base_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLoadIdentity (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLoadMatrixd ( double []m); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLoadMatrixf ( float []m); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLoadName (uint name); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glLogicOp (uint opcode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMap1d (uint target, double u1, double u2, int stride, int order, double []points); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMap1f (uint target, float u1, float u2, int stride, int order, float []points); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMap2d (uint target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, double []points); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMap2f (uint target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, float []points); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMapGrid1d (int un, double u1, double u2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMapGrid1f (int un, float u1, float u2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMapGrid2d (int un, double u1, double u2, int vn, double v1, double v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMapGrid2f (int un, float u1, float u2, int vn, float v1, float v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMaterialf (uint face, uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMaterialfv (uint face, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMateriali (uint face, uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMaterialiv (uint face, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMatrixMode (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMultMatrixd ( double []m); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glMultMatrixf ( float []m); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNewList (uint list, uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3b (byte nx, byte ny, byte nz); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3bv ( byte []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3d (double nx, double ny, double nz); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3f (float nx, float ny, float nz); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3i (int nx, int ny, int nz); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3s (short nx, short ny, short nz); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormal3sv(short[] v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormalPointer(uint type, int stride, IntPtr pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glNormalPointer (uint type, int stride, float[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glOrtho (double left, double right, double bottom, double top, double zNear, double zFar); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPassThrough (float token); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelMapfv (uint map, int mapsize, float []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelMapuiv (uint map, int mapsize, uint []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelMapusv (uint map, int mapsize, ushort []values); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelStoref (uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelStorei (uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelTransferf (uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelTransferi (uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPixelZoom (float xfactor, float yfactor); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPointSize (float size); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPolygonMode (uint face, uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPolygonOffset (float factor, float units); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPolygonStipple ( byte []mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPopAttrib (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPopClientAttrib (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPopMatrix (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPopName (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPrioritizeTextures (int n, uint []textures, float []priorities); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPushAttrib (uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPushClientAttrib (uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPushMatrix (); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glPushName (uint name); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2d (double x, double y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2f (float x, float y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2i (int x, int y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2s (short x, short y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos2sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3d (double x, double y, double z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3f (float x, float y, float z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3i (int x, int y, int z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3s (short x, short y, short z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos3sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4d (double x, double y, double z, double w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4f (float x, float y, float z, float w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4i (int x, int y, int z, int w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4s (short x, short y, short z, short w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRasterPos4sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glReadBuffer (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glReadPixels(int x, int y, int width, int height, uint format, uint type, byte[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glReadPixels(int x, int y, int width, int height, uint format, uint type, IntPtr pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectd (double x1, double y1, double x2, double y2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectdv ( double []v1, double []v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectf (float x1, float y1, float x2, float y2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectfv ( float []v1, float []v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRecti (int x1, int y1, int x2, int y2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectiv ( int []v1, int []v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRects (short x1, short y1, short x2, short y2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRectsv ( short []v1, short []v2); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern int glRenderMode (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRotated (double angle, double x, double y, double z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glRotatef (float angle, float x, float y, float z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glScaled (double x, double y, double z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glScalef (float x, float y, float z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glScissor (int x, int y, int width, int height); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glSelectBuffer (int size, uint []buffer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glShadeModel (uint mode); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glStencilFunc (uint func, int ref_notkeword, uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glStencilMask (uint mask); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glStencilOp (uint fail, uint zfail, uint zpass); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1d (double s); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1f (float s); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1i (int s); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1s (short s); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord1sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2d (double s, double t); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2f (float s, float t); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2i (int s, int t); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2s (short s, short t); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord2sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3d (double s, double t, double r); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3f (float s, float t, float r); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3i (int s, int t, int r); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3s (short s, short t, short r); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord3sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4d (double s, double t, double r, double q); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4f (float s, float t, float r, float q); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4i (int s, int t, int r, int q); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4s (short s, short t, short r, short q); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoord4sv(short[] v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoordPointer(int size, uint type, int stride, IntPtr pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexCoordPointer (int size, uint type, int stride, float[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexEnvf (uint target, uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexEnvfv (uint target, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexEnvi (uint target, uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexEnviv (uint target, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGend (uint coord, uint pname, double param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGendv (uint coord, uint pname, double []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGenf (uint coord, uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGenfv (uint coord, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGeni (uint coord, uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexGeniv (uint coord, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexImage1D (uint target, int level, uint internalformat, int width, int border, uint format, uint type, byte[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexImage2D (uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, byte[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexImage2D (uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, IntPtr pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexParameterf (uint target, uint pname, float param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexParameterfv (uint target, uint pname, float []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexParameteri (uint target, uint pname, int param); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexParameteriv (uint target, uint pname, int []params_notkeyword); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexSubImage1D (uint target, int level, int xoffset, int width, uint format, uint type, int[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTexSubImage2D (uint target, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, int[] pixels); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTranslated (double x, double y, double z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glTranslatef (float x, float y, float z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2d (double x, double y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2f (float x, float y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2i (int x, int y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2s (short x, short y); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex2sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3d (double x, double y, double z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3f (float x, float y, float z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3i (int x, int y, int z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3s (short x, short y, short z); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex3sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4d (double x, double y, double z, double w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4dv ( double []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4f (float x, float y, float z, float w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4fv ( float []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4i (int x, int y, int z, int w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4iv ( int []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4s (short x, short y, short z, short w); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertex4sv ( short []v); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertexPointer(int size, uint type, int stride, IntPtr pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertexPointer(int size, uint type, int stride, short[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertexPointer(int size, uint type, int stride, int[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertexPointer(int size, uint type, int stride, float[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glVertexPointer(int size, uint type, int stride, double[] pointer); + [DllImport(LIBRARY_OPENGL, SetLastError = true)] private static extern void glViewport (int x, int y, int width, int height); + + #endregion + + #region The GLU DLL Functions (Exactly the same naming). + + internal const string LIBRARY_GLU = "Glu32.dll"; + + [DllImport(LIBRARY_GLU, SetLastError = true)] private static unsafe extern sbyte* gluErrorString(uint errCode); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static unsafe extern sbyte* gluGetString(int name); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluOrtho2D(double left, double right, double bottom, double top); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluPerspective (double fovy, double aspect, double zNear, double zFar); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluPickMatrix ( double x, double y, double width, double height, int[] viewport); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluLookAt ( double eyex, double eyey, double eyez, double centerx, double centery, double centerz, double upx, double upy, double upz); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluProject (double objx, double objy, double objz, double[] modelMatrix, double[] projMatrix, int[] viewport, double [] winx, double []winy, double []winz); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluUnProject (double winx, double winy, double winz, double[] modelMatrix, double[] projMatrix, int[] viewport, ref double objx, ref double objy, ref double objz); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluScaleImage (int format, int widthin, int heightin, int typein, int []datain, int widthout, int heightout, int typeout, int[] dataout); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluBuild1DMipmaps (uint target, uint components, int width, uint format, uint type, IntPtr data); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluBuild2DMipmaps (uint target, uint components, int width, int height, uint format, uint type, IntPtr data); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern IntPtr gluNewQuadric(); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluDeleteQuadric (IntPtr state); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluQuadricNormals (IntPtr quadObject, uint normals); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluQuadricTexture (IntPtr quadObject, int textureCoords); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluQuadricOrientation (IntPtr quadObject, int orientation); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluQuadricDrawStyle (IntPtr quadObject, uint drawStyle); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluCylinder(IntPtr qobj,double baseRadius, double topRadius, double height,int slices,int stacks); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluDisk(IntPtr qobj, double innerRadius,double outerRadius,int slices, int loops); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluPartialDisk(IntPtr qobj,double innerRadius,double outerRadius, int slices, int loops, double startAngle, double sweepAngle); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluSphere(IntPtr qobj, double radius, int slices, int stacks); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern IntPtr gluNewTess(); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluDeleteTess(IntPtr tess); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessBeginPolygon(IntPtr tess, IntPtr polygonData); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessBeginContour(IntPtr tess); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessVertex(IntPtr tess,double[] coords, double[] data ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessEndContour( IntPtr tess ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessEndPolygon( IntPtr tess ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessProperty( IntPtr tess,int which, double value ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessNormal( IntPtr tess, double x,double y, double z ); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.Begin callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.BeginData callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.Combine callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.CombineData callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.EdgeFlag callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.EdgeFlagData callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.End callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.EndData callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.Error callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.ErrorData callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.Vertex callback); +// [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluTessCallback(IntPtr tess, int which, SharpGL.Delegates.Tesselators.VertexData callback); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluGetTessProperty( IntPtr tess,int which, double value ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern IntPtr gluNewNurbsRenderer (); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluDeleteNurbsRenderer (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluBeginSurface (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluBeginCurve (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluEndCurve (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluEndSurface (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluBeginTrim (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluEndTrim (IntPtr nobj); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluPwlCurve (IntPtr nobj, int count, float array, int stride, uint type); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluNurbsCurve(IntPtr nobj, int nknots, float[] knot, int stride, float[] ctlarray, int order, uint type); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluNurbsSurface(IntPtr nobj, int sknot_count, float[] sknot, int tknot_count, float[] tknot, int s_stride, int t_stride, float[] ctlarray, int sorder, int torder, uint type); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluLoadSamplingMatrices (IntPtr nobj, float[] modelMatrix, float[] projMatrix, int[] viewport); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluNurbsProperty(IntPtr nobj, int property, float value); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void gluGetNurbsProperty (IntPtr nobj, int property, float value ); + [DllImport(LIBRARY_GLU, SetLastError = true)] private static extern void IntPtrCallback(IntPtr nobj, int which, IntPtr Callback ); + + #endregion + + #region Wrapped OpenGL Functions + + /// + /// Set the Accumulation Buffer operation. + /// + /// Operation of the buffer. + /// Reference value. + public void Accum(uint op, float value) + { + PreGLCall(); + glAccum(op, value); + PostGLCall(); + } + + /// + /// Set the Accumulation Buffer operation. + /// + /// Operation of the buffer. + /// Reference value. + public void Accum(Enumerations.AccumOperation op, float value) + { + PreGLCall(); + glAccum((uint)op, value); + PostGLCall(); + } + + /// + /// Specify the Alpha Test function. + /// + /// Specifies the alpha comparison function. Symbolic constants OpenGL.NEVER, OpenGL.LESS, OpenGL.EQUAL, OpenGL.LEQUAL, OpenGL.GREATER, OpenGL.NOTEQUAL, OpenGL.GEQUAL and OpenGL.ALWAYS are accepted. The initial value is OpenGL.ALWAYS. + /// Specifies the reference value that incoming alpha values are compared to. This value is clamped to the range 0 through 1, where 0 represents the lowest possible alpha value and 1 the highest possible value. The initial reference value is 0. + public void AlphaFunc(uint func, float reference) + { + PreGLCall(); + glAlphaFunc(func, reference); + PostGLCall(); + } + + /// + /// Specify the Alpha Test function. + /// + /// Specifies the alpha comparison function. + /// Specifies the reference value that incoming alpha values are compared to. This value is clamped to the range 0 through 1, where 0 represents the lowest possible alpha value and 1 the highest possible value. The initial reference value is 0. + public void AlphaFunc(Enumerations.AlphaTestFunction function, float reference) + { + PreGLCall(); + glAlphaFunc((uint)function, reference); + PostGLCall(); + } + + /// + /// Determine if textures are loaded in texture memory. + /// + /// Specifies the number of textures to be queried. + /// Specifies an array containing the names of the textures to be queried. + /// Specifies an array in which the texture residence status is returned. The residence status of a texture named by an element of textures is returned in the corresponding element of residences. + /// + public byte AreTexturesResident(int n, uint []textures, byte []residences) + { + PreGLCall(); + byte returnValue = glAreTexturesResident(n, textures, residences); + PostGLCall(); + + return returnValue; + } + + /// + /// Render a vertex using the specified vertex array element. + /// + /// Specifies an index into the enabled vertex data arrays. + public void ArrayElement(int i) + { + PreGLCall(); + glArrayElement(i); + PostGLCall(); + } + + /// + /// Begin drawing geometry in the specified mode. + /// + /// The mode to draw in, e.g. OpenGL.POLYGONS. + public void Begin(uint mode) + { + // Do PreGLCall now, and PostGLCall AFTER End() + PreGLCall(); + + // Let's remember something important here - you CANNOT call 'glGetError' + // between glBegin and glEnd. So we set the 'begun' flag - this'll + // turn off error reporting until glEnd. + glBegin(mode); + + // Set the begun flag. + insideGLBegin = true; + } + + /// + /// Begin drawing geometry in the specified mode. + /// + /// The mode to draw in, e.g. OpenGL.POLYGONS. + public void Begin(Enumerations.BeginMode mode) + { + // Do PreGLCall now, and PostGLCall AFTER End() + PreGLCall(); + + // Let's remember something important here - you CANNOT call 'glGetError' + // between glBegin and glEnd. So we set the 'begun' flag - this'll + // turn off error reporting until glEnd. + glBegin((uint)mode); + + // Set the begun flag. + insideGLBegin = true; + } + + /// + /// This function begins drawing a NURBS curve. + /// + /// The NURBS object. + public void BeginCurve(IntPtr nurbsObject) + { + PreGLCall(); + gluBeginCurve(nurbsObject); + PostGLCall(); + } + + /// + /// This function begins drawing a NURBS surface. + /// + /// The NURBS object. + public void BeginSurface(IntPtr nurbsObject) + { + PreGLCall(); + gluBeginSurface(nurbsObject); + PostGLCall(); + } + + /// + /// Call this function after creating a texture to finalise creation of it, + /// or to make an existing texture current. + /// + /// The target type, e.g TEXTURE_2D. + /// The OpenGL texture object. + public void BindTexture(uint target, uint texture) + { + PreGLCall(); + glBindTexture(target, texture); + PostGLCall(); + } + + /// + /// Draw a bitmap. + /// + /// Specify the pixel width of the bitmap image. + /// Specify the pixel height of the bitmap image. + /// Specify the location of the origin in the bitmap image. The origin is measured from the lower left corner of the bitmap, with right and up being the positive axes. + /// Specify the location of the origin in the bitmap image. The origin is measured from the lower left corner of the bitmap, with right and up being the positive axes. + /// Specify the x and y offsets to be added to the current raster position after the bitmap is drawn. + /// Specify the x and y offsets to be added to the current raster position after the bitmap is drawn. + /// Specifies the address of the bitmap image. + public void Bitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, byte []bitmap) + { + PreGLCall(); + glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); + PostGLCall(); + } + + /// + /// This function sets the current blending function. + /// + /// Source factor. + /// Destination factor. + public void BlendFunc(uint sfactor, uint dfactor) + { + PreGLCall(); + glBlendFunc(sfactor,dfactor); + PostGLCall(); + } + + /// + /// This function sets the current blending function. + /// + /// The source factor. + /// The destination factor. + public void BlendFunc(Enumerations.BlendingSourceFactor sourceFactor, Enumerations.BlendingDestinationFactor destinationFactor) + { + PreGLCall(); + glBlendFunc((uint)sourceFactor, (uint)destinationFactor); + PostGLCall(); + } + + /// + /// This function calls a certain display list. + /// + /// The display list to call. + public void CallList(uint list) + { + PreGLCall(); + glCallList(list); + PostGLCall(); + } + + /// + /// Execute a list of display lists. + /// + /// Specifies the number of display lists to be executed. + /// Specifies the type of values in lists. Symbolic constants OpenGL.BYTE, OpenGL.UNSIGNED_BYTE, OpenGL.SHORT, OpenGL.UNSIGNED_SHORT, OpenGL.INT, OpenGL.UNSIGNED_INT, OpenGL.FLOAT, OpenGL.2_BYTES, OpenGL.3_BYTES and OpenGL.4_BYTES are accepted. + /// Specifies the address of an array of name offsets in the display list. The pointer type is void because the offsets can be bytes, shorts, ints, or floats, depending on the value of type. + public void CallLists (int n, uint type, IntPtr lists) + { + PreGLCall(); + glCallLists(n, type, lists); + PostGLCall(); + } + + /// + /// Execute a list of display lists. + /// + /// Specifies the number of display lists to be executed. + /// Specifies the type of values in lists. Symbolic constants OpenGL.BYTE, OpenGL.UNSIGNED_BYTE, OpenGL.SHORT, OpenGL.UNSIGNED_SHORT, OpenGL.INT, OpenGL.UNSIGNED_INT, OpenGL.FLOAT, OpenGL.2_BYTES, OpenGL.3_BYTES and OpenGL.4_BYTES are accepted. + /// Specifies the address of an array of name offsets in the display list. The pointer type is void because the offsets can be bytes, shorts, ints, or floats, depending on the value of type. + public void CallLists(int n, Enumerations.DataType type, IntPtr lists) + { + PreGLCall(); + glCallLists(n, (uint)type, lists); + PostGLCall(); + } + + /// + /// Execute a list of display lists. Automatically uses the GL_UNSIGNED_BYTE version of the function. + /// + /// The number of lists. + /// The lists. + public void CallLists(int n, byte[] lists) + { + PreGLCall(); + glCallLists(n, GL_UNSIGNED_BYTE, lists); + PostGLCall(); + } + + /// + /// Execute a list of display lists. Automatically uses the GL_UNSIGNED_INT version of the function. + /// + /// The number of lists. + /// The lists. + public void CallLists(int n, uint[] lists) + { + PreGLCall(); + glCallLists(n, GL_UNSIGNED_INT, lists); + PostGLCall(); + } + + /// + /// This function clears the buffers specified by mask. + /// + /// Which buffers to clear. + public void Clear(uint mask) + { + PreGLCall(); + glClear(mask); + PostGLCall(); + } + + /// + /// Specify clear values for the accumulation buffer. + /// + /// Specify the red, green, blue and alpha values used when the accumulation buffer is cleared. The initial values are all 0. + /// Specify the red, green, blue and alpha values used when the accumulation buffer is cleared. The initial values are all 0. + /// Specify the red, green, blue and alpha values used when the accumulation buffer is cleared. The initial values are all 0. + /// Specify the red, green, blue and alpha values used when the accumulation buffer is cleared. The initial values are all 0. + public void ClearAccum (float red, float green, float blue, float alpha) + { + PreGLCall(); + glClearAccum(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// This function sets the color that the drawing buffer is 'cleared' to. + /// + /// Red component of the color (between 0 and 1). + /// Green component of the color (between 0 and 1). + /// Blue component of the color (between 0 and 1)./ + /// Alpha component of the color (between 0 and 1). + public void ClearColor (float red, float green, float blue, float alpha) + { + PreGLCall(); + glClearColor(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Specify the clear value for the depth buffer. + /// + /// Specifies the depth value used when the depth buffer is cleared. The initial value is 1. + public void ClearDepth(double depth) + { + PreGLCall(); + glClearDepth(depth); + PostGLCall(); + } + + /// + /// Specify the clear value for the color index buffers. + /// + /// Specifies the index used when the color index buffers are cleared. The initial value is 0. + public void ClearIndex (float c) + { + PreGLCall(); + glClearIndex(c); + PostGLCall(); + } + + /// + /// Specify the clear value for the stencil buffer. + /// + /// Specifies the index used when the stencil buffer is cleared. The initial value is 0. + public void ClearStencil (int s) + { + PreGLCall(); + glClearStencil(s); + PostGLCall(); + } + + /// + /// Specify a plane against which all geometry is clipped. + /// + /// Specifies which clipping plane is being positioned. Symbolic names of the form OpenGL.CLIP_PLANEi, where i is an integer between 0 and OpenGL.MAX_CLIP_PLANES -1, are accepted. + /// Specifies the address of an array of four double-precision floating-point values. These values are interpreted as a plane equation. + public void ClipPlane (uint plane, double []equation) + { + PreGLCall(); + glClipPlane(plane, equation); + PostGLCall(); + } + + /// + /// Specify a plane against which all geometry is clipped. + /// + /// Specifies which clipping plane is being positioned. Symbolic names of the form OpenGL.CLIP_PLANEi, where i is an integer between 0 and OpenGL.MAX_CLIP_PLANES -1, are accepted. + /// Specifies the address of an array of four double-precision floating-point values. These values are interpreted as a plane equation. + public void ClipPlane(Enumerations.ClipPlaneName plane, double[] equation) + { + PreGLCall(); + glClipPlane((uint)plane, equation); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 255). + /// Green color component (between 0 and 255). + /// Blue color component (between 0 and 255). + public void Color(byte red, byte green, byte blue) + { + PreGLCall(); + glColor3ub(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 255). + /// Green color component (between 0 and 255). + /// Blue color component (between 0 and 255). + /// Alpha color component (between 0 and 255). + public void Color(byte red, byte green, byte blue, byte alpha) + { + PreGLCall(); + glColor4ub(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(double red, double green, double blue) + { + PreGLCall(); + glColor3d(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component. + public void Color(double red, double green, double blue, double alpha) + { + PreGLCall(); + glColor4d(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(float red, float green, float blue) + { + PreGLCall(); + glColor3f(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 float values. + public void Color(float[] v) + { + PreGLCall(); + if(v.Length == 3) + glColor3fv(v); + else if(v.Length == 4) + glColor4fv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 int values. + public void Color(int[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3iv(v); + else if (v.Length == 4) + glColor4iv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 int values. + public void Color(short[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3sv(v); + else if (v.Length == 4) + glColor4sv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 double values. + public void Color(double[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3dv(v); + else if (v.Length == 4) + glColor4dv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 byte values. + public void Color(byte[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3bv(v); + else if (v.Length == 4) + glColor4bv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 unsigned int values. + public void Color(uint[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3uiv(v); + else if (v.Length == 4) + glColor4uiv(v); + PostGLCall(); + } + + /// + /// Sets the current color to 'v'. + /// + /// An array of either 3 or 4 unsigned short values. + public void Color(ushort[] v) + { + PreGLCall(); + if (v.Length == 3) + glColor3usv(v); + else if (v.Length == 4) + glColor4usv(v); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(int red, int green, int blue) + { + PreGLCall(); + glColor3i(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component. + public void Color(int red, int green, int blue, int alpha) + { + PreGLCall(); + glColor4i(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(short red, short green, short blue) + { + PreGLCall(); + glColor3s(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component. + public void Color(short red, short green, short blue, short alpha) + { + PreGLCall(); + glColor4s(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(uint red, uint green, uint blue) + { + PreGLCall(); + glColor3ui(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component. + public void Color(uint red, uint green, uint blue, uint alpha) + { + PreGLCall(); + glColor4ui(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + public void Color(ushort red, ushort green, ushort blue) + { + PreGLCall(); + glColor3us(red, green, blue); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component. + public void Color(ushort red, ushort green, ushort blue, ushort alpha) + { + PreGLCall(); + glColor4us(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Sets the current color. + /// + /// Red color component (between 0 and 1). + /// Green color component (between 0 and 1). + /// Blue color component (between 0 and 1). + /// Alpha color component (between 0 and 1). + public void Color(float red, float green, float blue, float alpha) + { + PreGLCall(); + glColor4f(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// This function sets the current colour mask. + /// + /// Red component mask. + /// Green component mask. + /// Blue component mask. + /// Alpha component mask. + public void ColorMask(byte red, byte green, byte blue, byte alpha) + { + PreGLCall(); + glColorMask(red, green, blue, alpha); + PostGLCall(); + } + + /// + /// Cause a material color to track the current color. + /// + /// Specifies whether front, back, or both front and back material parameters should track the current color. Accepted values are OpenGL.FRONT, OpenGL.BACK, and OpenGL.FRONT_AND_BACK. The initial value is OpenGL.FRONT_AND_BACK. + /// Specifies which of several material parameters track the current color. Accepted values are OpenGL.EMISSION, OpenGL.AMBIENT, OpenGL.DIFFUSE, OpenGL.SPECULAR and OpenGL.AMBIENT_AND_DIFFUSE. The initial value is OpenGL.AMBIENT_AND_DIFFUSE. + public void ColorMaterial (uint face, uint mode) + { + PreGLCall(); + glColorMaterial(face, mode); + PostGLCall(); + } + + /// + /// Define an array of colors. + /// + /// Specifies the number of components per color. Must be 3 or 4. + /// Specifies the data type of each color component in the array. Symbolic constants OpenGL.BYTE, OpenGL.UNSIGNED_BYTE, OpenGL.SHORT, OpenGL.UNSIGNED_SHORT, OpenGL.INT, OpenGL.UNSIGNED_INT, OpenGL.FLOAT and OpenGL.DOUBLE are accepted. + /// Specifies the byte offset between consecutive colors. If stride is 0, (the initial value), the colors are understood to be tightly packed in the array. + /// Specifies a pointer to the first component of the first color element in the array. + public void ColorPointer (int size, uint type, int stride, IntPtr pointer) + { + PreGLCall(); + glColorPointer(size, type, stride, pointer); + PostGLCall(); + } + + /// + /// Copy pixels in the frame buffer. + /// + /// Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied. + /// Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied. + /// Specify the dimensions of the rectangular region of pixels to be copied. Both must be nonnegative. + /// Specify the dimensions of the rectangular region of pixels to be copied. Both must be nonnegative. + /// Specifies whether color values, depth values, or stencil values are to be copied. Symbolic constants OpenGL.COLOR, OpenGL.DEPTH, and OpenGL.STENCIL are accepted. + public void CopyPixels (int x, int y, int width, int height, uint type) + { + PreGLCall(); + glCopyPixels(x, y, width, height, type); + PostGLCall(); + } + + /// + /// Copy pixels into a 1D texture image. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the internal format of the texture. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specifies the width of the texture image. Must be 0 or 2^n = (2 * border) for some integer n. The height of the texture image is 1. + /// Specifies the width of the border. Must be either 0 or 1. + public void CopyTexImage1D (uint target, int level, uint internalFormat, int x, int y, int width, int border) + { + PreGLCall(); + glCopyTexImage1D(target, level, internalFormat, x, y, width, border); + PostGLCall(); + } + + /// + /// Copy pixels into a 2D texture image. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_2D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the internal format of the texture. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specifies the width of the texture image. + /// Specifies the height of the texture image. + /// Specifies the width of the border. Must be either 0 or 1. + public void CopyTexImage2D (uint target, int level, uint internalFormat, int x, int y, int width, int height, int border) + { + PreGLCall(); + glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border); + PostGLCall(); + } + + /// + /// Copy a one-dimensional texture subimage. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the texel offset within the texture array. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specifies the width of the texture image. + public void CopyTexSubImage1D (uint target, int level, int xoffset, int x, int y, int width) + { + PreGLCall(); + glCopyTexSubImage1D(target, level, xoffset, x, y, width); + PostGLCall(); + } + + /// + /// Copy a two-dimensional texture subimage. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_2D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the texel offset within the texture array. + /// Specifies the texel offset within the texture array. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specify the window coordinates of the left corner of the row of pixels to be copied. + /// Specifies the width of the texture image. + /// Specifies the height of the texture image. + public void CopyTexSubImage2D (uint target, int level, int xoffset, int yoffset, int x, int y, int width, int height) + { + PreGLCall(); + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + PostGLCall(); + } + + /// + /// Specify whether front- or back-facing facets can be culled. + /// + /// Specifies whether front- or back-facing facets are candidates for culling. Symbolic constants OpenGL.FRONT, OpenGL.BACK, and OpenGL.FRONT_AND_BACK are accepted. The initial value is OpenGL.BACK. + public void CullFace (uint mode) + { + PreGLCall(); + glCullFace(mode); + PostGLCall(); + } + + /// + /// This function draws a sphere from the quadric object. + /// + /// The quadric object. + /// Radius at the base. + /// Radius at the top. + /// Height of cylinder. + /// Cylinder slices. + /// Cylinder stacks. + public void Cylinder(IntPtr qobj, double baseRadius, double topRadius, double height,int slices, int stacks) + { + PreGLCall(); + gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks); + PostGLCall(); + } + + /// + /// This function deletes a list, or a range of lists. + /// + /// The list to delete. + /// The range of lists (often just 1). + public void DeleteLists(uint list, int range) + { + PreGLCall(); + glDeleteLists(list, range); + PostGLCall(); + } + + /// + /// This function deletes the underlying glu nurbs renderer. + /// + /// The pointer to the nurbs object. + public void DeleteNurbsRenderer(IntPtr nurbsObject) + { + PreGLCall(); + gluDeleteNurbsRenderer(nurbsObject); + PostGLCall(); + } + + /// + /// This function deletes a set of Texture objects. + /// + /// Number of textures to delete. + /// The array containing the names of the textures to delete. + public void DeleteTextures (int n, uint []textures) + { + PreGLCall(); + glDeleteTextures(n, textures); + PostGLCall(); + } + + /// + /// Call this function to delete an OpenGL Quadric object. + /// + /// + public void DeleteQuadric(IntPtr quadric) + { + PreGLCall(); + gluDeleteQuadric(quadric); + PostGLCall(); + } + + /// + /// This function sets the current depth buffer comparison function, the default it LESS. + /// + /// The comparison function to set. + public void DepthFunc(uint func) + { + PreGLCall(); + glDepthFunc(func); + PostGLCall(); + } + + /// + /// This function sets the current depth buffer comparison function, the default it LESS. + /// + /// The comparison function to set. + public void DepthFunc(Enumerations.DepthFunction function) + { + PreGLCall(); + glDepthFunc((uint)function); + PostGLCall(); + } + + + /// + /// This function sets the depth mask. + /// + /// The depth mask flag, normally 1. + public void DepthMask(byte flag) + { + PreGLCall(); + glDepthMask(flag); + PostGLCall(); + } + + /// + /// Specify mapping of depth values from normalized device coordinates to window coordinates. + /// + /// Specifies the mapping of the near clipping plane to window coordinates. The initial value is 0. + /// Specifies the mapping of the near clipping plane to window coordinates. The initial value is 1. + public void DepthRange (double zNear, double zFar) + { + PreGLCall(); + glDepthRange(zNear, zFar); + PostGLCall(); + } + + /// + /// Call this function to disable an OpenGL capability. + /// + /// The capability to disable. + public void Disable(uint cap) + { + PreGLCall(); + glDisable(cap); + PostGLCall(); + } + + /// + /// This function disables a client state array, such as a vertex array. + /// + /// The array to disable. + public void DisableClientState (uint array) + { + PreGLCall(); + glDisableClientState(array); + PostGLCall(); + } + + /// + /// Render primitives from array data. + /// + /// Specifies what kind of primitives to render. Symbolic constants OpenGL.POINTS, OpenGL.LINE_STRIP, OpenGL.LINE_LOOP, OpenGL.LINES, OpenGL.TRIANGLE_STRIP, OpenGL.TRIANGLE_FAN, OpenGL.TRIANGLES, OpenGL.QUAD_STRIP, OpenGL.QUADS, and OpenGL.POLYGON are accepted. + /// Specifies the starting index in the enabled arrays. + /// Specifies the number of indices to be rendered. + public void DrawArrays (uint mode, int first, int count) + { + PreGLCall(); + glDrawArrays(mode, first, count); + PostGLCall(); + } + + /// + /// Specify which color buffers are to be drawn into. + /// + /// Specifies up to four color buffers to be drawn into. Symbolic constants OpenGL.NONE, OpenGL.FRONT_LEFT, OpenGL.FRONT_RIGHT, OpenGL.BACK_LEFT, OpenGL.BACK_RIGHT, OpenGL.FRONT, OpenGL.BACK, OpenGL.LEFT, OpenGL.RIGHT, OpenGL.FRONT_AND_BACK, and OpenGL.AUXi, where i is between 0 and (OpenGL.AUX_BUFFERS - 1), are accepted (OpenGL.AUX_BUFFERS is not the upper limit; use glGet to query the number of available aux buffers.) The initial value is OpenGL.FRONT for single- buffered contexts, and OpenGL.BACK for double-buffered contexts. + public void DrawBuffer (uint mode) + { + PreGLCall(); + glDrawBuffer(mode); + PostGLCall(); + } + + /// + /// Specify which color buffers are to be drawn into. + /// + /// Specifies up to four color buffers to be drawn into. + public void DrawBuffer(Enumerations.DrawBufferMode drawBufferMode) + { + PreGLCall(); + glDrawBuffer((uint)drawBufferMode); + PostGLCall(); + } + + /// + /// Render primitives from array data. + /// + /// Specifies what kind of primitives to render. Symbolic constants OpenGL.POINTS, OpenGL.LINE_STRIP, OpenGL.LINE_LOOP, OpenGL.LINES, OpenGL.TRIANGLE_STRIP, OpenGL.TRIANGLE_FAN, OpenGL.TRIANGLES, OpenGL.QUAD_STRIP, OpenGL.QUADS, and OpenGL.POLYGON are accepted. + /// Specifies the number of elements to be rendered. + /// Specifies a pointer to the location where the indices are stored. + public void DrawElements(uint mode, int count, uint[] indices) + { + PreGLCall(); + glDrawElements(mode, count, GL_UNSIGNED_INT, indices); + PostGLCall(); + } + + /// + /// Render primitives from array data. + /// + /// Specifies what kind of primitives to render. Symbolic constants OpenGL.POINTS, OpenGL.LINE_STRIP, OpenGL.LINE_LOOP, OpenGL.LINES, OpenGL.TRIANGLE_STRIP, OpenGL.TRIANGLE_FAN, OpenGL.TRIANGLES, OpenGL.QUAD_STRIP, OpenGL.QUADS, and OpenGL.POLYGON are accepted. + /// Specifies the number of elements to be rendered. + /// Specifies the type of the values in indices. Must be one of OpenGL.UNSIGNED_BYTE, OpenGL.UNSIGNED_SHORT, or OpenGL.UNSIGNED_INT. + /// Specifies a pointer to the location where the indices are stored. + public void DrawElements(uint mode, int count, uint type, IntPtr indices) + { + PreGLCall(); + glDrawElements(mode, count, type, indices); + PostGLCall(); + } + + /// + /// Draws a rectangle of pixel data at the current raster position. + /// + /// Width of pixel data. + /// Height of pixel data. + /// Format of pixel data. + /// Pixel data buffer. + public void DrawPixels(int width, int height, uint format, float[] pixels) + { + PreGLCall(); + glDrawPixels(width, height, format, GL_FLOAT, pixels); + PostGLCall(); + } + + /// + /// Draws a rectangle of pixel data at the current raster position. + /// + /// Width of pixel data. + /// Height of pixel data. + /// Format of pixel data. + /// Pixel data buffer. + public void DrawPixels(int width, int height, uint format, uint[] pixels) + { + PreGLCall(); + glDrawPixels(width, height, format, GL_UNSIGNED_INT, pixels); + PostGLCall(); + } + + /// + /// Draws a rectangle of pixel data at the current raster position. + /// + /// Width of pixel data. + /// Height of pixel data. + /// Format of pixel data. + /// Pixel data buffer. + public void DrawPixels(int width, int height, uint format, ushort[] pixels) + { + PreGLCall(); + glDrawPixels(width, height, format, GL_UNSIGNED_SHORT, pixels); + PostGLCall(); + } + + /// + /// Draws a rectangle of pixel data at the current raster position. + /// + /// Width of pixel data. + /// Height of pixel data. + /// Format of pixel data. + /// Pixel data buffer. + public void DrawPixels(int width, int height, uint format, byte[] pixels) + { + PreGLCall(); + glDrawPixels(width, height, format, GL_UNSIGNED_BYTE, pixels); + PostGLCall(); + } + + /// + /// Draws a rectangle of pixel data at the current raster position. + /// + /// Width of pixel data. + /// Height of pixel data. + /// Format of pixel data. + /// The GL data type. + /// Pixel data buffer. + public void DrawPixels(int width, int height, uint format, uint type, IntPtr pixels) + { + PreGLCall(); + glDrawPixels(width, height, format, type, pixels); + PostGLCall(); + } + + /// + /// Flag edges as either boundary or nonboundary. + /// + /// Specifies the current edge flag value, either OpenGL.TRUE or OpenGL.FALSE. The initial value is OpenGL.TRUE. + public void EdgeFlag (byte flag) + { + PreGLCall(); + glEdgeFlag(flag); + PostGLCall(); + } + + /// + /// Define an array of edge flags. + /// + /// Specifies the byte offset between consecutive edge flags. If stride is 0 (the initial value), the edge flags are understood to be tightly packed in the array. + /// Specifies a pointer to the first edge flag in the array. + public void EdgeFlagPointer (int stride, int[] pointer) + { + PreGLCall(); + glEdgeFlagPointer(stride, pointer); + PostGLCall(); + } + + /// + /// Flag edges as either boundary or nonboundary. + /// + /// Specifies a pointer to an array that contains a single boolean element, which replaces the current edge flag value. + public void EdgeFlag( byte []flag) + { + PreGLCall(); + glEdgeFlagv(flag); + PostGLCall(); + } + + /// + /// Call this function to enable an OpenGL capability. + /// + /// The capability you wish to enable. + public void Enable(uint cap) + { + PreGLCall(); + glEnable(cap); + PostGLCall(); + } + + /// + /// This function enables one of the client state arrays, such as a vertex array. + /// + /// The array to enable. + public void EnableClientState(uint array) + { + PreGLCall(); + glEnableClientState(array); + PostGLCall(); + } + + /// + /// This is not an imported OpenGL function, but very useful. If 'test' is + /// true, cap is enabled, otherwise, it's disable. + /// + /// The capability you want to enable. + /// The logical comparison. + public void EnableIf(uint cap, bool test) + { + if(test) Enable(cap); + else Disable(cap); + } + + /// + /// Signals the End of drawing. + /// + public void End() + { + glEnd(); + + // Clear the begun flag. + insideGLBegin = false; + + // This matches Begin()'s PreGLCall() + PostGLCall(); + } + + /// + /// This function ends the drawing of a NURBS curve. + /// + /// The nurbs object. + public void EndCurve(IntPtr nurbsObject) + { + PreGLCall(); + gluEndCurve(nurbsObject); + PostGLCall(); + } + + /// + /// Ends the current display list compilation. + /// + public void EndList() + { + PreGLCall(); + glEndList(); + PostGLCall(); + } + + /// + /// This function ends the drawing of a NURBS surface. + /// + /// The nurbs object. + public void EndSurface(IntPtr nurbsObject) + { + PreGLCall(); + gluEndSurface(nurbsObject); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord1(double u) + { + PreGLCall(); + glEvalCoord1d(u); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord1( double []u) + { + PreGLCall(); + glEvalCoord1dv(u); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord1(float u) + { + PreGLCall(); + glEvalCoord1f(u); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord1( float []u) + { + PreGLCall(); + glEvalCoord1fv(u); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + /// Domain coordinate. + public void EvalCoord2(double u, double v) + { + PreGLCall(); + glEvalCoord2d(u, v); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord2(double[] u) + { + PreGLCall(); + glEvalCoord2dv(u); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + /// Domain coordinate. + public void EvalCoord2(float u, float v) + { + PreGLCall(); + glEvalCoord2f(u, v); + PostGLCall(); + } + + /// + /// Evaluate from the current evaluator. + /// + /// Domain coordinate. + public void EvalCoord2(float[] u) + { + PreGLCall(); + glEvalCoord2fv(u); + PostGLCall(); + } + + /// + /// Evaluates a 'mesh' from the current evaluators. + /// + /// Drawing mode, can be POINT or LINE. + /// Beginning of range. + /// End of range. + public void EvalMesh1(uint mode, int i1, int i2) + { + PreGLCall(); + glEvalMesh1(mode, i1, i2); + PostGLCall(); + } + /// + /// Evaluates a 'mesh' from the current evaluators. + /// + /// Drawing mode, fill, point or line. + /// Beginning of range. + /// End of range. + /// Beginning of range. + /// End of range. + public void EvalMesh2(uint mode, int i1, int i2, int j1, int j2) + { + PreGLCall(); + glEvalMesh2(mode, i1, i2, j1, j2); + PostGLCall(); + } + + /// + /// Generate and evaluate a single point in a mesh. + /// + /// The integer value for grid domain variable i. + public void EvalPoint1(int i) + { + PreGLCall(); + glEvalPoint1(i); + PostGLCall(); + } + + /// + /// Generate and evaluate a single point in a mesh. + /// + /// The integer value for grid domain variable i. + /// The integer value for grid domain variable j. + public void EvalPoint2(int i, int j) + { + PreGLCall(); + glEvalPoint2(i, j); + PostGLCall(); + } + + /// + /// This function sets the feedback buffer, that will receive feedback data. + /// + /// Size of the buffer. + /// Type of data in the buffer. + /// The buffer itself. + public void FeedbackBuffer(int size, uint type, float []buffer) + { + PreGLCall(); + glFeedbackBuffer(size, type, buffer); + PostGLCall(); + } + + /// + /// This function is similar to flush, but in a sense does it more, as it + /// executes all commands aon both the client and the server. + /// + public void Finish() + { + PreGLCall(); + glFinish(); + PostGLCall(); + } + + /// + /// This forces OpenGL to execute any commands you have given it. + /// + public void Flush() + { + PreGLCall(); + glFlush(); + PostGLCall(); + } + + /// + /// Sets a fog parameter. + /// + /// The parameter to set. + /// The value to set it to. + public void Fog(uint pname, float param) + { + PreGLCall(); + glFogf(pname, param); + PostGLCall(); + } + + /// + /// Sets a fog parameter. + /// + /// The parameter to set. + /// The values to set it to. + public void Fog(uint pname, float[] parameters) + { + PreGLCall(); + glFogfv(pname, parameters); + PostGLCall(); + } + + /// + /// Sets a fog parameter. + /// + /// The parameter to set. + /// The value to set it to. + public void Fog(uint pname, int param) + { + PreGLCall(); + glFogi(pname, param); + PostGLCall(); + } + + /// + /// Sets a fog parameter. + /// + /// The parameter to set. + /// The values to set it to. + public void Fog(uint pname, int[] parameters) + { + PreGLCall(); + glFogiv(pname, parameters); + PostGLCall(); + } + + /// + /// This function sets what defines a front face. + /// + /// Winding mode, counter clockwise by default. + public void FrontFace(uint mode) + { + PreGLCall(); + glFrontFace(mode); + PostGLCall(); + } + + /// + /// This function creates a frustrum transformation and mulitplies it to the current + /// matrix (which in most cases should be the projection matrix). + /// + /// Left clip position. + /// Right clip position. + /// Bottom clip position. + /// Top clip position. + /// Near clip position. + /// Far clip position. + public void Frustum(double left, double right, double bottom, + double top, double zNear, double zFar) + { + PreGLCall(); + glFrustum(left, right, bottom, top, zNear, zFar); + PostGLCall(); + } + + /// + /// This function generates 'range' number of contiguos display list indices. + /// + /// The number of lists to generate. + /// The first list. + public uint GenLists(int range) + { + PreGLCall(); + uint list = glGenLists(range); + PostGLCall(); + + return list; + } + + /// + /// Create a set of unique texture names. + /// + /// Number of names to create. + /// Array to store the texture names. + public void GenTextures(int n, uint []textures) + { + PreGLCall(); + glGenTextures(n, textures); + PostGLCall(); + } + + /// + /// This function queries OpenGL for data, and puts it in the buffer supplied. + /// + /// The parameter to query. + /// + public void GetBooleanv (uint pname, byte[] parameters) + { + PreGLCall(); + glGetBooleanv(pname, parameters); + PostGLCall(); + } + + /// + /// This function queries OpenGL for data, and puts it in the buffer supplied. + /// + /// The parameter to query. + /// + public void GetBooleanv(Enumerations.GetTarget pname, byte[] parameters) + { + PreGLCall(); + glGetBooleanv((uint)pname, parameters); + PostGLCall(); + } + + /// + /// Return the coefficients of the specified clipping plane. + /// + /// Specifies a clipping plane. The number of clipping planes depends on the implementation, but at least six clipping planes are supported. They are identified by symbolic names of the form OpenGL.CLIP_PLANEi where 0 Less Than i Less Than OpenGL.MAX_CLIP_PLANES. + /// Returns four double-precision values that are the coefficients of the plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). + public void GetClipPlane (uint plane, double []equation) + { + PreGLCall(); + glGetClipPlane(plane, equation); + PostGLCall(); + } + + /// + /// This function queries OpenGL for data, and puts it in the buffer supplied. + /// + /// The parameter to query. + /// The buffer to put that data into. + public void GetDouble(uint pname, double []parameters) + { + PreGLCall(); + glGetDoublev(pname, parameters); + PostGLCall(); + } + + /// + /// This function queries OpenGL for data, and puts it in the buffer supplied. + /// + /// The parameter to query. + /// The buffer to put that data into. + public void GetDouble(Enumerations.GetTarget pname, double[] parameters) + { + PreGLCall(); + glGetDoublev((uint)pname, parameters); + PostGLCall(); + } + + /// + /// Get the current OpenGL error code. + /// + /// The current OpenGL error code. + public uint GetError() + { + return glGetError(); + } + + /// + /// Get the current OpenGL error code. + /// + /// The current OpenGL error code. + public Enumerations.ErrorCode GetErrorCode() + { + return (Enumerations.ErrorCode)glGetError(); + } + + /// + /// This this function to query OpenGL values. + /// + /// The parameter to query. + /// The parameters + public void GetFloat(uint pname, float[] parameters) + { + PreGLCall(); + glGetFloatv(pname, parameters); + PostGLCall(); + } + + /// + /// This this function to query OpenGL values. + /// + /// The parameter to query. + /// The parameters + public void GetFloat(Enumerations.GetTarget pname, float[] parameters) + { + PreGLCall(); + glGetFloatv((uint)pname, parameters); + PostGLCall(); + } + + /// + /// Use this function to query OpenGL parameter values. + /// + /// The Parameter to query + /// An array to put the values into. + public void GetInteger(uint pname, int[] parameters) + { + PreGLCall(); + glGetIntegerv(pname, parameters); + PostGLCall(); + } + + /// + /// Use this function to query OpenGL parameter values. + /// + /// The Parameter to query + /// An array to put the values into. + public void GetInteger(Enumerations.GetTarget pname, int[] parameters) + { + PreGLCall(); + glGetIntegerv((uint)pname, parameters); + PostGLCall(); + } + + /// + /// Return light source parameter values. + /// + /// Specifies a light source. The number of possible lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form OpenGL.LIGHTi where i ranges from 0 to the value of OpenGL.GL_MAX_LIGHTS - 1. + /// Specifies a light source parameter for light. + /// Returns the requested data. + public void GetLight(uint light, uint pname, float []parameters) + { + PreGLCall(); + glGetLightfv(light, pname, parameters); + PostGLCall(); + } + + /// + /// Return light source parameter values. + /// + /// Specifies a light source. The number of possible lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form OpenGL.LIGHTi where i ranges from 0 to the value of OpenGL.GL_MAX_LIGHTS - 1. + /// Specifies a light source parameter for light. + /// Returns the requested data. + public void GetLight(uint light, uint pname, int[] parameters) + { + PreGLCall(); + glGetLightiv(light, pname, parameters); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(uint target, uint query, double []v) + { + PreGLCall(); + glGetMapdv(target, query, v); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(Enumerations.GetMapTarget target, uint query, double[] v) + { + PreGLCall(); + glGetMapdv((uint)target, query, v); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(Enumerations.GetMapTarget target, uint query, float[] v) + { + PreGLCall(); + glGetMapfv((uint)target, query, v); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(uint target, uint query, float []v) + { + PreGLCall(); + glGetMapfv(target, query, v); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(Enumerations.GetMapTarget target, uint query, int[] v) + { + PreGLCall(); + glGetMapiv((uint)target, query, v); + PostGLCall(); + } + + /// + /// Return evaluator parameters. + /// + /// Specifies the symbolic name of a map. + /// Specifies which parameter to return. + /// Returns the requested data. + public void GetMap(uint target, uint query, int []v) + { + PreGLCall(); + glGetMapiv(target, query, v); + PostGLCall(); + } + + /// + /// Return material parameters. + /// + /// Specifies which of the two materials is being queried. OpenGL.FRONT or OpenGL.BACK are accepted, representing the front and back materials, respectively. + /// Specifies the material parameter to return. + /// Returns the requested data. + public void GetMaterial(uint face, uint pname, float[] parameters) + { + PreGLCall(); + glGetMaterialfv(face, pname, parameters); + PostGLCall(); + } + + /// + /// Return material parameters. + /// + /// Specifies which of the two materials is being queried. OpenGL.FRONT or OpenGL.BACK are accepted, representing the front and back materials, respectively. + /// Specifies the material parameter to return. + /// Returns the requested data. + public void GetMaterial(uint face, uint pname, int[] parameters) + { + PreGLCall(); + glGetMaterialiv(face, pname, parameters); + PostGLCall(); + } + + /// + /// Return the specified pixel map. + /// + /// Specifies the name of the pixel map to return. + /// Returns the pixel map contents. + public void GetPixelMap(uint map, float []values) + { + PreGLCall(); + glGetPixelMapfv(map, values); + PostGLCall(); + } + + /// + /// Return the specified pixel map. + /// + /// Specifies the name of the pixel map to return. + /// Returns the pixel map contents. + public void GetPixelMap(uint map, uint []values) + { + PreGLCall(); + glGetPixelMapuiv(map, values); + PostGLCall(); + } + + /// + /// Return the specified pixel map. + /// + /// Specifies the name of the pixel map to return. + /// Returns the pixel map contents. + public void GetPixelMap(uint map, ushort []values) + { + PreGLCall(); + glGetPixelMapusv(map, values); + PostGLCall(); + } + + /// + /// Return the address of the specified pointer. + /// + /// Specifies the array or buffer pointer to be returned. + /// Returns the pointer value specified by parameters. + public void GetPointerv (uint pname, int[] parameters) + { + PreGLCall(); + glGetPointerv(pname, parameters); + PostGLCall(); + } + + /// + /// Return the polygon stipple pattern. + /// + /// Returns the stipple pattern. The initial value is all 1's. + public void GetPolygonStipple (byte []mask) + { + PreGLCall(); + glGetPolygonStipple(mask); + PostGLCall(); + } + + /// + /// Return a string describing the current GL connection. + /// + /// Specifies a symbolic constant, one of OpenGL.VENDOR, OpenGL.RENDERER, OpenGL.VERSION, or OpenGL.EXTENSIONS. + /// Pointer to the specified string. + public unsafe string GetString (uint name) + { + PreGLCall(); + sbyte* pStr = glGetString(name); + var str = new string(pStr); + PostGLCall(); + + return str; + } + + /// + /// Return texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a texture environment parameter. Accepted values are OpenGL.TEXTURE_ENV_MODE, and OpenGL.TEXTURE_ENV_COLOR. + /// Returns the requested data. + public void GetTexEnv(uint target, uint pname, float []parameters) + { + PreGLCall(); + glGetTexEnvfv(target, pname, parameters); + PostGLCall(); + } + + /// + /// Return texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a texture environment parameter. Accepted values are OpenGL.TEXTURE_ENV_MODE, and OpenGL.TEXTURE_ENV_COLOR. + /// Returns the requested data. + public void GetTexEnv(uint target, uint pname, int[] parameters) + { + PreGLCall(); + glGetTexEnviv(target, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void GetTexGen(uint coord, uint pname, double[] parameters) + { + PreGLCall(); + glGetTexGendv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void GetTexGen(uint coord, uint pname, float[] parameters) + { + PreGLCall(); + glGetTexGenfv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void GetTexGen(uint coord, uint pname, int[] parameters) + { + PreGLCall(); + glGetTexGeniv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// Return a texture image. + /// + /// Specifies which texture is to be obtained. OpenGL.TEXTURE_1D and OpenGL.TEXTURE_2D are accepted. + /// Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies a pixel format for the returned data. + /// Specifies a pixel type for the returned data. + /// Returns the texture image. Should be a pointer to an array of the type specified by type. + public void GetTexImage (uint target, int level, uint format, uint type, int []pixels) + { + PreGLCall(); + glGetTexImage(target, level, format, type, pixels); + PostGLCall(); + } + + /// + /// Return texture parameter values for a specific level of detail. + /// + /// Specifies the symbolic name of the target texture. + /// Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the symbolic name of a texture parameter. + /// Returns the requested data. + public void GetTexLevelParameter(uint target, int level, uint pname, float []parameters) + { + PreGLCall(); + glGetTexLevelParameterfv(target, level, pname, parameters); + PostGLCall(); + } + + /// + /// Return texture parameter values for a specific level of detail. + /// + /// Specifies the symbolic name of the target texture. + /// Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies the symbolic name of a texture parameter. + /// Returns the requested data. + public void GetTexLevelParameter(uint target, int level, uint pname, int[] parameters) + { + PreGLCall(); + glGetTexLevelParameteriv(target, level, pname, parameters); + PostGLCall(); + } + + /// + /// Return texture parameter values. + /// + /// Specifies the symbolic name of the target texture. + /// Specifies the symbolic name of a texture parameter. + /// Returns the texture parameters. + public void GetTexParameter(uint target, uint pname, float[] parameters) + { + PreGLCall(); + glGetTexParameterfv(target, pname, parameters); + PostGLCall(); + } + /// + /// Return texture parameter values. + /// + /// Specifies the symbolic name of the target texture. + /// Specifies the symbolic name of a texture parameter. + /// Returns the texture parameters. + public void GetTexParameter(uint target, uint pname, int[] parameters) + { + PreGLCall(); + glGetTexParameteriv(target, pname, parameters); + PostGLCall(); + } + + /// + /// Specify implementation-specific hints. + /// + /// Specifies a symbolic constant indicating the behavior to be controlled. + /// Specifies a symbolic constant indicating the desired behavior. + public void Hint (uint target, uint mode) + { + PreGLCall(); + glHint(target, mode); + PostGLCall(); + } + + /// + /// Specify implementation-specific hints. + /// + /// Specifies a symbolic constant indicating the behavior to be controlled. + /// Specifies a symbolic constant indicating the desired behavior. + public void Hint(Enumerations.HintTarget target, Enumerations.HintMode mode) + { + PreGLCall(); + glHint((uint)target, (uint)mode); + PostGLCall(); + } + + /// + /// Control the writing of individual bits in the color index buffers. + /// + /// Specifies a bit mask to enable and disable the writing of individual bits in the color index buffers. Initially, the mask is all 1's. + public void IndexMask (uint mask) + { + PreGLCall(); + glIndexMask(mask); + PostGLCall(); + } + + /// + /// Define an array of color indexes. + /// + /// Specifies the data type of each color index in the array. Symbolic constants OpenGL.UNSIGNED_BYTE, OpenGL.SHORT, OpenGL.INT, OpenGL.FLOAT, and OpenGL.DOUBLE are accepted. + /// Specifies the byte offset between consecutive color indexes. If stride is 0 (the initial value), the color indexes are understood to be tightly packed in the array. + /// Specifies a pointer to the first index in the array. + public void IndexPointer (uint type, int stride, int[] pointer) + { + PreGLCall(); + glIndexPointer(type, stride, pointer); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(double c) + { + PreGLCall(); + glIndexd(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(double[] c) + { + PreGLCall(); + glIndexdv(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(float c) + { + PreGLCall(); + glIndexf(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(float[] c) + { + PreGLCall(); + glIndexfv(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(int c) + { + PreGLCall(); + glIndexi(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(int[] c) + { + PreGLCall(); + glIndexiv(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(short c) + { + PreGLCall(); + glIndexs(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(short[] c) + { + PreGLCall(); + glIndexsv(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(byte c) + { + PreGLCall(); + glIndexub(c); + PostGLCall(); + } + + /// + /// Set the current color index. + /// + /// Specifies the new value for the current color index. + public void Index(byte[] c) + { + PreGLCall(); + glIndexubv(c); + PostGLCall(); + } + + /// + /// This function initialises the select buffer names. + /// + public void InitNames() + { + PreGLCall(); + glInitNames(); + PostGLCall(); + } + + /// + /// Simultaneously specify and enable several interleaved arrays. + /// + /// Specifies the type of array to enable. + /// Specifies the offset in bytes between each aggregate array element. + /// The array. + public void InterleavedArrays (uint format, int stride, int[] pointer) + { + PreGLCall(); + glInterleavedArrays(format, stride, pointer); + PostGLCall(); + } + + /// + /// Use this function to query if a certain OpenGL function is enabled or not. + /// + /// The capability to test. + /// True if the capability is enabled, otherwise, false. + public bool IsEnabled (uint cap) + { + PreGLCall(); + byte e = glIsEnabled(cap); + PostGLCall(); + + return e != 0; + } + + /// + /// This function determines whether a specified value is a display list. + /// + /// The value to test. + /// TRUE if it is a list, FALSE otherwise. + public byte IsList(uint list) + { + PreGLCall(); + byte islist = glIsList(list); + PostGLCall(); + + return islist; + } + + /// + /// Determine if a name corresponds to a texture. + /// + /// Specifies a value that may be the name of a texture. + /// True if texture is a texture object. + public byte IsTexture (uint texture) + { + PreGLCall(); + byte returnValue = glIsTexture(texture); + PostGLCall(); + + return returnValue; + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(uint pname, float param) + { + PreGLCall(); + glLightModelf(pname, param); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(Enumerations.LightModelParameter pname, float param) + { + PreGLCall(); + glLightModelf((uint)pname, param); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(uint pname, float[] parameters) + { + PreGLCall(); + glLightModelfv(pname, parameters); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(Enumerations.LightModelParameter pname, float[] parameters) + { + PreGLCall(); + glLightModelfv((uint)pname, parameters); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(uint pname, int param) + { + PreGLCall(); + glLightModeli(pname, param); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(Enumerations.LightModelParameter pname, int param) + { + PreGLCall(); + glLightModeli((uint)pname, param); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel (uint pname, int[] parameters) + { + PreGLCall(); + glLightModeliv(pname, parameters); + PostGLCall(); + } + + /// + /// This function sets a parameter of the lighting model. + /// + /// The name of the parameter. + /// The parameter to set it to. + public void LightModel(Enumerations.LightModelParameter pname, int[] parameters) + { + PreGLCall(); + glLightModeliv((uint)pname, parameters); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(uint light, uint pname, float param) + { + PreGLCall(); + glLightf(light, pname, param); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(Enumerations.LightName light, Enumerations.LightParameter pname, float param) + { + PreGLCall(); + glLightf((uint)light, (uint)pname, param); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(uint light, uint pname, float[] parameters) + { + PreGLCall(); + glLightfv(light, pname, parameters); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(Enumerations.LightName light, Enumerations.LightParameter pname, float[] parameters) + { + PreGLCall(); + glLightfv((uint)light, (uint)pname, parameters); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(uint light, uint pname, int param) + { + PreGLCall(); + glLighti(light, pname, param); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The value that you want to set the parameter to. + public void Light(Enumerations.LightName light, Enumerations.LightParameter pname, int param) + { + PreGLCall(); + glLighti((uint)light, (uint)pname, param); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The parameters. + public void Light(uint light, uint pname, int []parameters) + { + PreGLCall(); + glLightiv(light, pname, parameters); + PostGLCall(); + } + + /// + /// Set the parameter (pname) of the light 'light'. + /// + /// The light you wish to set parameters for. + /// The parameter you want to set. + /// The parameters. + public void Light(Enumerations.LightName light, Enumerations.LightParameter pname, int[] parameters) + { + PreGLCall(); + glLightiv((uint)light, (uint)pname, parameters); + PostGLCall(); + } + + /// + /// Specify the line stipple pattern. + /// + /// Specifies a multiplier for each bit in the line stipple pattern. If factor is 3, for example, each bit in the pattern is used three times before the next bit in the pattern is used. factor is clamped to the range [1, 256] and defaults to 1. + /// Specifies a 16-bit integer whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first; the default pattern is all 1's. + public void LineStipple(int factor, ushort pattern) + { + PreGLCall(); + glLineStipple(factor, pattern); + PostGLCall(); + } + + /// + /// Set's the current width of lines. + /// + /// New line width to set. + public void LineWidth(float width) + { + PreGLCall(); + glLineWidth(width); + PostGLCall(); + } + + /// + /// Set the display-list base for glCallLists. + /// + /// Specifies an integer offset that will be added to glCallLists offsets to generate display-list names. The initial value is 0. + public void ListBase (uint listbase) + { + PreGLCall(); + glListBase(listbase); + PostGLCall(); + } + + /// + /// Call this function to load the identity matrix into the current matrix stack. + /// + public void LoadIdentity() + { + PreGLCall(); + glLoadIdentity(); + PostGLCall(); + } + + /// + /// Replace the current matrix with the specified matrix. + /// + /// Specifies a pointer to 16 consecutive values, which are used as the elements of a 4x4 column-major matrix. + public void LoadMatrix( double []m) + { + PreGLCall(); + glLoadMatrixd(m); + PreGLCall(); + } + + /// + /// Replace the current matrix with the specified matrix. + /// + /// Specifies a pointer to 16 consecutive values, which are used as the elements of a 4x4 column-major matrix. + public void LoadMatrixf(float[] m) + { + PreGLCall(); + glLoadMatrixf(m); + PreGLCall(); + } + + /// + /// This function replaces the name at the top of the selection names stack + /// with 'name'. + /// + /// The name to replace it with. + public void LoadName (uint name) + { + PreGLCall(); + glLoadName(name); + PostGLCall(); + } + + /// + /// Specify a logical pixel operation for color index rendering. + /// + /// Specifies a symbolic constant that selects a logical operation. + public void LogicOp (uint opcode) + { + PreGLCall(); + glLogicOp(opcode); + PostGLCall(); + } + + /// + /// Specify a logical pixel operation for color index rendering. + /// + /// Specifies a symbolic constant that selects a logical operation. + public void LogicOp(Enumerations.LogicOp logicOp) + { + PreGLCall(); + glLogicOp((uint)logicOp); + PostGLCall(); + } + + /// + /// This function transforms the projection matrix so that it looks at a certain + /// point, from a certain point. + /// + /// Position of the eye. + /// Position of the eye. + /// Position of the eye. + /// Point to look at. + /// Point to look at. + /// Point to look at. + /// 'Up' Vector X Component. + /// 'Up' Vector Y Component. + /// 'Up' Vector Z Component. + public void LookAt(double eyex, double eyey, double eyez, + double centerx, double centery, double centerz, + double upx, double upy, double upz) + { + PreGLCall(); + gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz); + PostGLCall(); + } + + /// + /// Defines a 1D evaluator. + /// + /// What the control points represent (e.g. MAP1_VERTEX_3). + /// Range of the variable 'u'. + /// Range of the variable 'u'. + /// Offset between beginning of one control point, and beginning of next. + /// The degree plus one, should agree with the number of control points. + /// The data for the points. + public void Map1(uint target, double u1, double u2, int stride, int order, double []points) + { + PreGLCall(); + glMap1d(target, u1, u2, stride, order, points); + PostGLCall(); + } + + /// + /// Defines a 1D evaluator. + /// + /// What the control points represent (e.g. MAP1_VERTEX_3). + /// Range of the variable 'u'. + /// Range of the variable 'u'. + /// Offset between beginning of one control point, and beginning of next. + /// The degree plus one, should agree with the number of control points. + /// The data for the points. + public void Map1(uint target, float u1, float u2, int stride, int order, float []points) + { + PreGLCall(); + glMap1f(target, u1, u2, stride, order, points); + PostGLCall(); + } + + /// + /// Defines a 2D evaluator. + /// + /// What the control points represent (e.g. MAP2_VERTEX_3). + /// Range of the variable 'u'. + /// Range of the variable 'u. + /// Offset between beginning of one control point and the next. + /// The degree plus one. + /// Range of the variable 'v'. + /// Range of the variable 'v'. + /// Offset between beginning of one control point and the next. + /// The degree plus one. + /// The data for the points. + public void Map2(uint target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, double []points) + { + PreGLCall(); + glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + PostGLCall(); + } + + /// + /// Defines a 2D evaluator. + /// + /// What the control points represent (e.g. MAP2_VERTEX_3). + /// Range of the variable 'u'. + /// Range of the variable 'u. + /// Offset between beginning of one control point and the next. + /// The degree plus one. + /// Range of the variable 'v'. + /// Range of the variable 'v'. + /// Offset between beginning of one control point and the next. + /// The degree plus one. + /// The data for the points. + public void Map2(uint target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, float []points) + { + PreGLCall(); + glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + PostGLCall(); + } + + /// + /// This function defines a grid that goes from u1 to u1 in n steps, evenly spaced. + /// + /// Number of steps. + /// Range of variable 'u'. + /// Range of variable 'u'. + public void MapGrid1(int un, double u1, double u2) + { + PreGLCall(); + glMapGrid1d(un, u1, u2); + PostGLCall(); + } + + /// + /// This function defines a grid that goes from u1 to u1 in n steps, evenly spaced. + /// + /// Number of steps. + /// Range of variable 'u'. + /// Range of variable 'u'. + public void MapGrid1(int un, float u1, float u2) + { + PreGLCall(); + glMapGrid1d(un, u1, u2); + PostGLCall(); + } + + /// + /// This function defines a grid that goes from u1 to u1 in n steps, evenly spaced, + /// and the same for v. + /// + /// Number of steps. + /// Range of variable 'u'. + /// Range of variable 'u'. + /// Number of steps. + /// Range of variable 'v'. + /// Range of variable 'v'. + public void MapGrid2(int un, double u1, double u2, int vn, double v1, double v2) + { + PreGLCall(); + glMapGrid2d(un, u1, u2, vn, v1, v2); + PostGLCall(); + } + + /// + /// This function defines a grid that goes from u1 to u1 in n steps, evenly spaced, + /// and the same for v. + /// + /// Number of steps. + /// Range of variable 'u'. + /// Range of variable 'u'. + /// Number of steps. + /// Range of variable 'v'. + /// Range of variable 'v'. + public void MapGrid2(int un, float u1, float u2, int vn, float v1, float v2) + { + PreGLCall(); + glMapGrid2f(un, u1, u2, vn, v1, v2); + PostGLCall(); + } + + /// + /// This function sets a material parameter. + /// + /// What faces is this parameter for (i.e front/back etc). + /// What parameter you want to set. + /// The value to set 'pname' to. + public void Material(uint face, uint pname, float param) + { + PreGLCall(); + glMaterialf(face, pname, param); + PostGLCall(); + } + + /// + /// This function sets a material parameter. + /// + /// What faces is this parameter for (i.e front/back etc). + /// What parameter you want to set. + /// The value to set 'pname' to. + public void Material(uint face, uint pname, float[] parameters) + { + PreGLCall(); + glMaterialfv(face, pname, parameters); + PostGLCall(); + } + + /// + /// This function sets a material parameter. + /// + /// What faces is this parameter for (i.e front/back etc). + /// What parameter you want to set. + /// The value to set 'pname' to. + public void Material(uint face, uint pname, int param) + { + PreGLCall(); + glMateriali(face, pname, param); + PostGLCall(); + } + + /// + /// This function sets a material parameter. + /// + /// What faces is this parameter for (i.e front/back etc). + /// What parameter you want to set. + /// The value to set 'pname' to. + public void Material(uint face, uint pname, int[] parameters) + { + PreGLCall(); + glMaterialiv(face, pname, parameters); + PostGLCall(); + } + + /// + /// Set the current matrix mode (the matrix that matrix operations will be + /// performed on). + /// + /// The mode, normally PROJECTION or MODELVIEW. + public void MatrixMode (uint mode) + { + PreGLCall(); + glMatrixMode(mode); + PostGLCall(); + } + + /// + /// Set the current matrix mode (the matrix that matrix operations will be + /// performed on). + /// + /// The mode, normally PROJECTION or MODELVIEW. + public void MatrixMode(Enumerations.MatrixMode mode) + { + PreGLCall(); + glMatrixMode((uint)mode); + PostGLCall(); + } + + /// + /// Multiply the current matrix with the specified matrix. + /// + /// Points to 16 consecutive values that are used as the elements of a 4x4 column-major matrix. + public void MultMatrix( double []m) + { + PreGLCall(); + glMultMatrixd(m); + PostGLCall(); + } + + /// + /// Multiply the current matrix with the specified matrix. + /// + /// Points to 16 consecutive values that are used as the elements of a 4x4 column-major matrix. + public void MultMatrix( float []m) + { + PreGLCall(); + glMultMatrixf(m); + PostGLCall(); + } + + /// + /// This function starts compiling a new display list. + /// + /// The list to compile. + /// Either COMPILE or COMPILE_AND_EXECUTE. + public void NewList(uint list, uint mode) + { + PreGLCall(); + glNewList(list, mode); + PostGLCall(); + } + + /// + /// This function creates a new glu NURBS renderer object. + /// + /// A Pointer to the NURBS renderer. + public IntPtr NewNurbsRenderer() + { + PreGLCall(); + IntPtr nurbs = gluNewNurbsRenderer(); + PostGLCall(); + + return nurbs; + } + + /// + /// This function creates a new OpenGL Quadric Object. + /// + /// The pointer to the Quadric Object. + public IntPtr NewQuadric() + { + PreGLCall(); + IntPtr quad = gluNewQuadric(); + PostGLCall(); + + return quad; + } + + /// + /// Set the current normal. + /// + /// Normal Coordinate. + /// Normal Coordinate. + /// Normal Coordinate. + public void Normal(byte nx, byte ny, byte nz) + { + PreGLCall(); + glNormal3b(nx, ny, nz); + PostGLCall(); + } + + /// + /// This function sets the current normal. + /// + /// The normal. + public void Normal(byte[] v) + { + PreGLCall(); + glNormal3bv(v); + PostGLCall(); + } + + /// + /// Set the current normal. + /// + /// Normal Coordinate. + /// Normal Coordinate. + /// Normal Coordinate. + public void Normal(double nx, double ny, double nz) + { + PreGLCall(); + glNormal3d(nx, ny, nz); + PostGLCall(); + } + + /// + /// This function sets the current normal. + /// + /// The normal. + public void Normal(double[] v) + { + PreGLCall(); + glNormal3dv(v); + PostGLCall(); + } + + /// + /// Set the current normal. + /// + /// Normal Coordinate. + /// Normal Coordinate. + /// Normal Coordinate. + public void Normal(float nx, float ny, float nz) + { + PreGLCall(); + glNormal3f(nx, ny, nz); + PostGLCall(); + } + + /// + /// This function sets the current normal. + /// + /// The normal. + public void Normal(float[] v) + { + PreGLCall(); + glNormal3fv(v); + PostGLCall(); + } + + /// + /// Set the current normal. + /// + /// Normal Coordinate. + /// Normal Coordinate. + /// Normal Coordinate. + public void Normal3i(int nx, int ny, int nz) + { + PreGLCall(); + glNormal3i(nx, ny, nz); + PostGLCall(); + } + + /// + /// This function sets the current normal. + /// + /// The normal. + public void Normal(int[] v) + { + PreGLCall(); + glNormal3iv(v); + PostGLCall(); + } + + /// + /// Set the current normal. + /// + /// Normal Coordinate. + /// Normal Coordinate. + /// Normal Coordinate. + public void Normal(short nx, short ny, short nz) + { + PreGLCall(); + glNormal3s(nx, ny, nz); + PostGLCall(); + } + + /// + /// This function sets the current normal. + /// + /// The normal. + public void Normal(short[] v) + { + PreGLCall(); + glNormal3sv(v); + PostGLCall(); + } + + /// + /// Set's the pointer to the normal array. + /// + /// The type of data. + /// The space in bytes between each normal. + /// The normals. + public void NormalPointer(uint type, int stride, IntPtr pointer) + { + PreGLCall(); + glNormalPointer(type, stride, pointer); + PostGLCall(); + } + + /// + /// Set's the pointer to the normal array. + /// + /// The type of data. + /// The space in bytes between each normal. + /// The normals. + public void NormalPointer(uint type, int stride, float[] pointer) + { + PreGLCall(); + glNormalPointer(type, stride, pointer); + PostGLCall(); + } + + /// + /// This function defines a NURBS Curve. + /// + /// The NURBS object. + /// The number of knots. + /// The knots themselves. + /// The stride, i.e. distance between vertices in the + /// control points array. + /// The array of control points. + /// The order of the polynomial. + /// The type of data to generate. + public void NurbsCurve(IntPtr nurbsObject, int knotsCount, float[] knots, + int stride, float[] controlPointsArray, int order, uint type) + { + PreGLCall(); + gluNurbsCurve(nurbsObject, knotsCount, knots, stride, controlPointsArray, + order, type); + PostGLCall(); + } + + /// + /// This function sets a NURBS property. + /// + /// The object to set the property for. + /// The property to set. + /// The new value of the property. + public void NurbsProperty(IntPtr nurbsObject, int property, float value) + { + PreGLCall(); + gluNurbsProperty(nurbsObject, property, value); + PostGLCall(); + } + + /// + /// This function defines a NURBS surface. + /// + /// The NURBS object. + /// The sknots count. + /// The s-knots. + /// The number of t-knots. + /// The t-knots. + /// The distance between s vertices. + /// The distance between t vertices. + /// The control points. + /// The order of the s polynomial. + /// The order of the t polynomial. + /// The type of data to generate. + public void NurbsSurface(IntPtr nurbsObject, int sknotsCount, float[] sknots, + int tknotsCount, float[] tknots, int sStride, int tStride, + float[] controlPointsArray, int sOrder, int tOrder, uint type) + { + PreGLCall(); + gluNurbsSurface(nurbsObject, sknotsCount, sknots, tknotsCount, tknots, + sStride, tStride, controlPointsArray, sOrder, tOrder, type); + PostGLCall(); + } + + /// + /// This function creates an orthographic projection matrix (i.e one with no + /// perspective) and multiplies it to the current matrix stack, which would + /// normally be 'PROJECTION'. + /// + /// Left clipping plane. + /// Right clipping plane. + /// Bottom clipping plane. + /// Top clipping plane. + /// Near clipping plane. + /// Far clipping plane. + public void Ortho(double left, double right, double bottom, + double top, double zNear, double zFar) + { + PreGLCall(); + glOrtho(left, right, bottom, top, zNear, zFar); + PostGLCall(); + } + /// + /// This function creates an orthographic project based on a screen size. + /// + /// Left of the screen. (Normally 0). + /// Right of the screen.(Normally width). + /// Bottom of the screen (normally 0). + /// Top of the screen (normally height). + public void Ortho2D(double left, double right, double bottom, double top) + { + PreGLCall(); + gluOrtho2D(left, right, bottom, top); + PostGLCall(); + } + + /// + /// This function draws a partial disk from the quadric object. + /// + /// The Quadric objec.t + /// Radius of the inside of the disk. + /// Radius of the outside of the disk. + /// The slices. + /// The loops. + /// Starting angle. + /// Sweep angle. + public void PartialDisk(IntPtr qobj,double innerRadius,double outerRadius, int slices, int loops, double startAngle, double sweepAngle) + { + PreGLCall(); + gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle); + PostGLCall(); + } + + /// + /// Place a marker in the feedback buffer. + /// + /// Specifies a marker value to be placed in the feedback buffer following a OpenGL.PASS_THROUGH_TOKEN. + public void PassThrough (float token) + { + PreGLCall(); + glPassThrough(token); + PostGLCall(); + } + + /// + /// This function creates a perspective matrix and multiplies it to the current + /// matrix stack (which in most cases should be 'PROJECTION'). + /// + /// Field of view angle (human eye = 60 Degrees). + /// Apsect Ratio (width of screen divided by height of screen). + /// Near clipping plane (normally 1). + /// Far clipping plane. + public void Perspective(double fovy, double aspect, double zNear, double zFar) + { + PreGLCall(); + gluPerspective(fovy, aspect, zNear, zFar); + PostGLCall(); + } + + /// + /// This function creates a 'pick matrix' normally used for selecting objects that + /// are at a certain point on the screen. + /// + /// X Point. + /// Y Point. + /// Width of point to test (4 is normal). + /// Height of point to test (4 is normal). + /// The current viewport. + public void PickMatrix(double x, double y, double width, double height, int[] viewport) + { + PreGLCall(); + gluPickMatrix(x, y, width, height, viewport); + PostGLCall(); + } + + /// + /// Set up pixel transfer maps. + /// + /// Specifies a symbolic map name. + /// Specifies the size of the map being defined. + /// Specifies an array of mapsize values. + public void PixelMap(uint map, int mapsize, float[] values) + { + PreGLCall(); + glPixelMapfv(map, mapsize, values); + PostGLCall(); + } + + /// + /// Set up pixel transfer maps. + /// + /// Specifies a symbolic map name. + /// Specifies the size of the map being defined. + /// Specifies an array of mapsize values. + public void PixelMap(uint map, int mapsize, uint[] values) + { + PreGLCall(); + glPixelMapuiv(map, mapsize, values); + PostGLCall(); + } + + /// + /// Set up pixel transfer maps. + /// + /// Specifies a symbolic map name. + /// Specifies the size of the map being defined. + /// Specifies an array of mapsize values. + public void PixelMap(uint map, int mapsize, ushort[] values) + { + PreGLCall(); + glPixelMapusv(map, mapsize, values); + PostGLCall(); + } + + /// + /// Set pixel storage modes. + /// + /// Specifies the symbolic name of the parameter to be set. + /// Specifies the value that pname is set to. + public void PixelStore(uint pname, float param) + { + PreGLCall(); + glPixelStoref(pname, param); + PostGLCall(); + } + + /// + /// Set pixel storage modes. + /// + /// Specifies the symbolic name of the parameter to be set. + /// Specifies the value that pname is set to. + public void PixelStore(uint pname, int param) + { + PreGLCall(); + glPixelStorei(pname, param); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(uint pname, bool param) + { + PreGLCall(); + int p = param ? 1 : 0; + glPixelTransferi(pname, p); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(Enumerations.PixelTransferParameterName pname, bool param) + { + PreGLCall(); + int p = param ? 1 : 0; + glPixelTransferi((uint)pname, p); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(uint pname, float param) + { + PreGLCall(); + glPixelTransferf(pname, param); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(Enumerations.PixelTransferParameterName pname, float param) + { + PreGLCall(); + glPixelTransferf((uint)pname, param); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(uint pname, int param) + { + PreGLCall(); + glPixelTransferi(pname, param); + PostGLCall(); + } + + /// + /// Set pixel transfer modes. + /// + /// Specifies the symbolic name of the pixel transfer parameter to be set. + /// Specifies the value that pname is set to. + public void PixelTransfer(Enumerations.PixelTransferParameterName pname, int param) + { + PreGLCall(); + glPixelTransferi((uint)pname, param); + PostGLCall(); + } + + /// + /// Specify the pixel zoom factors. + /// + /// Specify the x and y zoom factors for pixel write operations. + /// Specify the x and y zoom factors for pixel write operations. + public void PixelZoom (float xfactor, float yfactor) + { + PreGLCall(); + glPixelZoom(xfactor, yfactor); + PostGLCall(); + } + + /// + /// The size of points to be rasterised. + /// + /// Size in pixels. + public void PointSize(float size) + { + PreGLCall(); + glPointSize(size); + PostGLCall(); + } + + /// + /// This sets the current drawing mode of polygons (points, lines, filled). + /// + /// The faces this applies to (front, back or both). + /// The mode to set to (points, lines, or filled). + public void PolygonMode(uint face, uint mode) + { + PreGLCall(); + glPolygonMode(face, mode); + PostGLCall(); + } + + /// + /// This sets the current drawing mode of polygons (points, lines, filled). + /// + /// The faces this applies to (front, back or both). + /// The mode to set to (points, lines, or filled). + public void PolygonMode(Enumerations.FaceMode face, Enumerations.PolygonMode mode) + { + PreGLCall(); + glPolygonMode((uint)face, (uint)mode); + PostGLCall(); + } + + /// + /// Set the scale and units used to calculate depth values. + /// + /// Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0. + /// Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0. + public void PolygonOffset (float factor, float units) + { + PreGLCall(); + glPolygonOffset(factor, units); + PostGLCall(); + } + + /// + /// Set the polygon stippling pattern. + /// + /// Specifies a pointer to a 32x32 stipple pattern that will be unpacked from memory in the same way that glDrawPixels unpacks pixels. + public void PolygonStipple ( byte []mask) + { + PreGLCall(); + glPolygonStipple(mask); + PostGLCall(); + } + + /// + /// This function restores the attribute stack to the state it was when + /// PushAttrib was called. + /// + public void PopAttrib() + { + PreGLCall(); + glPopAttrib(); + PostGLCall(); + } + + /// + /// Pop the client attribute stack. + /// + public void PopClientAttrib () + { + PreGLCall(); + glPopClientAttrib(); + PostGLCall(); + } + + /// + /// Restore the previously saved state of the current matrix stack. + /// + public void PopMatrix() + { + PreGLCall(); + glPopMatrix(); + PostGLCall(); + } + + /// + /// This takes the top name off the selection names stack. + /// + public void PopName() + { + PreGLCall(); + glPopName(); + PostGLCall(); + } + + /// + /// Set texture residence priority. + /// + /// Specifies the number of textures to be prioritized. + /// Specifies an array containing the names of the textures to be prioritized. + /// Specifies an array containing the texture priorities. A priority given in an element of priorities applies to the texture named by the corresponding element of textures. + public void PrioritizeTextures (int n, uint []textures, float []priorities) + { + PreGLCall(); + glPrioritizeTextures(n, textures, priorities); + PostGLCall(); + } + + /// + /// This function Maps the specified object coordinates into window coordinates. + /// + /// The object's x coord. + /// The object's y coord. + /// The object's z coord. + /// The modelview matrix. + /// The projection matrix. + /// The viewport. + /// The window x coord. + /// The Window y coord. + /// The Window z coord. + public void Project(double objx, double objy, double objz, double[] modelMatrix, double[] projMatrix, int[] viewport, double[] winx, double[] winy, double[] winz) + { + PreGLCall(); + gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz); + PostGLCall(); + } + + /// + /// Save the current state of the attribute groups specified by 'mask'. + /// + /// The attibute groups to save. + public void PushAttrib(uint mask) + { + PreGLCall(); + glPushAttrib(mask); + PostGLCall(); + } + + /// + /// Save the current state of the attribute groups specified by 'mask'. + /// + /// The attibute groups to save. + public void PushAttrib(Enumerations.AttributeMask mask) + { + PreGLCall(); + glPushAttrib((uint)mask); + PostGLCall(); + } + + /// + /// Push the client attribute stack. + /// + /// Specifies a mask that indicates which attributes to save. + public void PushClientAttrib (uint mask) + { + PreGLCall(); + glPushClientAttrib(mask); + PostGLCall(); + } + + /// + /// Save the current state of the current matrix stack. + /// + public void PushMatrix() + { + PreGLCall(); + glPushMatrix(); + PostGLCall(); + } + + /// + /// This function adds a new name to the selection buffer. + /// + /// The name to add. + public void PushName(uint name) + { + PreGLCall(); + glPushName(name); + PostGLCall(); + } + + /// + /// This set's the Generate Normals propery of the specified Quadric object. + /// + /// The quadric object. + /// The type of normals to generate. + public void QuadricNormals(IntPtr quadricObject, uint normals) + { + PreGLCall(); + gluQuadricNormals(quadricObject, normals); + PostGLCall(); + } + + /// + /// This function sets the type of texture coordinates being generated by + /// the specified quadric object. + /// + /// The quadric object. + /// The type of coordinates to generate. + public void QuadricTexture(IntPtr quadricObject, int textureCoords) + { + PreGLCall(); + gluQuadricTexture(quadricObject, textureCoords); + PostGLCall(); + } + + /// + /// This sets the orientation for the quadric object. + /// + /// The quadric object. + /// The orientation. + public void QuadricOrientation(IntPtr quadricObject, int orientation) + { + PreGLCall(); + gluQuadricOrientation(quadricObject, orientation); + PostGLCall(); + } + + /// + /// This sets the current drawstyle for the Quadric Object. + /// + /// The quadric object. + /// The draw style. + public void QuadricDrawStyle (IntPtr quadObject, uint drawStyle) + { + PreGLCall(); + gluQuadricDrawStyle(quadObject, drawStyle); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + public void RasterPos(double x, double y) + { + PreGLCall(); + glRasterPos2d(x, y); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// The coordinate. + public void RasterPos(double[] v) + { + PreGLCall(); + if (v.Length == 2) + glRasterPos2dv(v); + else if (v.Length == 3) + glRasterPos3dv(v); + else + glRasterPos4dv(v); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + public void RasterPos(float x, float y) + { + PreGLCall(); + glRasterPos2f(x, y); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// The coordinate. + public void RasterPos(float[] v) + { + PreGLCall(); + if (v.Length == 2) + glRasterPos2fv(v); + else if (v.Length == 3) + glRasterPos3fv(v); + else + glRasterPos4fv(v); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + public void RasterPos(int x, int y) + { + PreGLCall(); + glRasterPos2i(x, y); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// The coordinate. + public void RasterPos(int[] v) + { + PreGLCall(); + if (v.Length == 2) + glRasterPos2iv(v); + else if (v.Length == 3) + glRasterPos3iv(v); + else + glRasterPos4iv(v); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + public void RasterPos(short x, short y) + { + PreGLCall(); + glRasterPos2s(x, y); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// The coordinate. + public void RasterPos(short[] v) + { + PreGLCall(); + if (v.Length == 2) + glRasterPos2sv(v); + else if (v.Length == 3) + glRasterPos3sv(v); + else + glRasterPos4sv(v); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + public void RasterPos(double x, double y, double z) + { + PreGLCall(); + glRasterPos3d(x, y, z); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + public void RasterPos(float x, float y, float z) + { + PreGLCall(); + glRasterPos3f(x, y, z); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + public void RasterPos(int x, int y, int z) + { + PreGLCall(); + glRasterPos3i(x, y, z); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + public void RasterPos(short x, short y, short z) + { + PreGLCall(); + glRasterPos3s(x, y, z); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + /// W coordinate. + public void RasterPos(double x, double y, double z, double w) + { + PreGLCall(); + glRasterPos4d(x, y, z, w); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + /// W coordinate. + public void RasterPos(float x, float y, float z, float w) + { + PreGLCall(); + glRasterPos4f(x, y, z, w); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + /// W coordinate. + public void RasterPos(int x, int y, int z, int w) + { + PreGLCall(); + glRasterPos4i(x, y, z, w); + PostGLCall(); + } + + /// + /// This function sets the current raster position. + /// + /// X coordinate. + /// Y coordinate. + /// Z coordinate. + /// W coordinate. + public void RasterPos(short x, short y, short z, short w) + { + PreGLCall(); + glRasterPos4s(x, y, z, w); + PostGLCall(); + } + + /// + /// Select a color buffer source for pixels. + /// + /// Specifies a color buffer. Accepted values are OpenGL.FRONT_LEFT, OpenGL.FRONT_RIGHT, OpenGL.BACK_LEFT, OpenGL.BACK_RIGHT, OpenGL.FRONT, OpenGL.BACK, OpenGL.LEFT, OpenGL.GL_RIGHT, and OpenGL.AUXi, where i is between 0 and OpenGL.AUX_BUFFERS - 1. + public void ReadBuffer(uint mode) + { + PreGLCall(); + glReadBuffer(mode); + PostGLCall(); + } + + /// + /// Reads a block of pixels from the frame buffer. + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Width of block to read. + /// Height of block to read. + /// Specifies the format of the pixel data. The following symbolic values are accepted: OpenGL.COLOR_INDEX, OpenGL.STENCIL_INDEX, OpenGL.DEPTH_COMPONENT, OpenGL.RED, OpenGL.GREEN, OpenGL.BLUE, OpenGL.ALPHA, OpenGL.RGB, OpenGL.RGBA, OpenGL.LUMINANCE and OpenGL.LUMINANCE_ALPHA. + /// Specifies the data type of the pixel data.Must be one of OpenGL.UNSIGNED_BYTE, OpenGL.BYTE, OpenGL.BITMAP, OpenGL.UNSIGNED_SHORT, OpenGL.SHORT, OpenGL.UNSIGNED_INT, OpenGL.INT or OpenGL.FLOAT. + /// Storage for the pixel data received. + public void ReadPixels(int x, int y, int width, int height, uint format, + uint type, byte[] pixels) + { + PreGLCall(); + glReadPixels(x, y, width, height, format, type, pixels); + PostGLCall(); + } + + /// + /// Reads a block of pixels from the frame buffer. + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Width of block to read. + /// Height of block to read. + /// Specifies the format of the pixel data. The following symbolic values are accepted: OpenGL.COLOR_INDEX, OpenGL.STENCIL_INDEX, OpenGL.DEPTH_COMPONENT, OpenGL.RED, OpenGL.GREEN, OpenGL.BLUE, OpenGL.ALPHA, OpenGL.RGB, OpenGL.RGBA, OpenGL.LUMINANCE and OpenGL.LUMINANCE_ALPHA. + /// Specifies the data type of the pixel data.Must be one of OpenGL.UNSIGNED_BYTE, OpenGL.BYTE, OpenGL.BITMAP, OpenGL.UNSIGNED_SHORT, OpenGL.SHORT, OpenGL.UNSIGNED_INT, OpenGL.INT or OpenGL.FLOAT. + /// Storage for the pixel data received. + public void ReadPixels(int x, int y, int width, int height, uint format, + uint type, IntPtr pixels) + { + PreGLCall(); + glReadPixels(x, y, width, height, format, type, pixels); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates (top-left and bottom-right). + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Bottom-Right X Value. + /// Bottom-Right Y Value. + public void Rect(double x1, double y1, double x2, double y2) + { + PreGLCall(); + glRectd(x1, y1, x2, y2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates, expressed as arrays, e.g + /// Rect(new float[] {0, 0}, new float[] {10, 10}); + /// + /// Top-Left point. + /// Bottom-Right point. + public void Rect( double []v1, double []v2) + { + PreGLCall(); + glRectdv(v1, v2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates (top-left and bottom-right). + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Bottom-Right X Value. + /// Bottom-Right Y Value. + public void Rect(float x1, float y1, float x2, float y2) + { + PreGLCall(); + glRectd(x1, y1, x2, y2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates, expressed as arrays, e.g + /// Rect(new float[] {0, 0}, new float[] {10, 10}); + /// + /// Top-Left point. + /// Bottom-Right point. + public void Rect(float []v1, float []v2) + { + PreGLCall(); + glRectfv(v1, v2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates (top-left and bottom-right). + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Bottom-Right X Value. + /// Bottom-Right Y Value. + public void Rect(int x1, int y1, int x2, int y2) + { + PreGLCall(); + glRecti(x1, y1, x2, y2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates, expressed as arrays, e.g + /// Rect(new float[] {0, 0}, new float[] {10, 10}); + /// + /// Top-Left point. + /// Bottom-Right point. + public void Rect( int []v1, int []v2) + { + PreGLCall(); + glRectiv(v1, v2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates (top-left and bottom-right). + /// + /// Top-Left X value. + /// Top-Left Y value. + /// Bottom-Right X Value. + /// Bottom-Right Y Value. + public void Rect(short x1, short y1, short x2, short y2) + { + PreGLCall(); + glRects(x1, y1, x2, y2); + PostGLCall(); + } + + /// + /// Draw a rectangle from two coordinates, expressed as arrays, e.g + /// Rect(new float[] {0, 0}, new float[] {10, 10}); + /// + /// Top-Left point. + /// Bottom-Right point. + public void Rect(short []v1, short []v2) + { + PreGLCall(); + glRectsv(v1, v2); + PostGLCall(); + } + + /// + /// This function sets the current render mode (render, feedback or select). + /// + /// The Render mode (RENDER, SELECT or FEEDBACK). + /// The hits that selection or feedback caused.. + public int RenderMode(uint mode) + { + PreGLCall(); + int hits = glRenderMode(mode); + PostGLCall(); + return hits; + } + + /// + /// This function sets the current render mode (render, feedback or select). + /// + /// The Render mode (RENDER, SELECT or FEEDBACK). + /// The hits that selection or feedback caused.. + public int RenderMode(Enumerations.RenderingMode mode) + { + PreGLCall(); + int hits = glRenderMode((uint)mode); + PostGLCall(); + return hits; + } + + /// + /// This function applies a rotation transformation to the current matrix. + /// + /// The angle to rotate. + /// Amount along x. + /// Amount along y. + /// Amount along z. + public void Rotate(double angle, double x, double y, double z) + { + PreGLCall(); + glRotated(angle, x, y, z); + PostGLCall(); + } + + /// + /// This function applies a rotation transformation to the current matrix. + /// + /// The angle to rotate. + /// Amount along x. + /// Amount along y. + /// Amount along z. + public void Rotate(float angle, float x, float y, float z) + { + PreGLCall(); + glRotatef(angle, x, y, z); + PostGLCall(); + } + + /// + /// This function quickly does three rotations, one about each axis, with the + /// given angles (it's not an OpenGL function, but very useful). + /// + /// The angle to rotate about x. + /// The angle to rotate about y. + /// The angle to rotate about z. + public void Rotate(float anglex, float angley, float anglez) + { + PreGLCall(); + glRotatef(anglex, 1, 0, 0); + glRotatef(angley, 0, 1, 0); + glRotatef(anglez, 0, 0, 1); + PostGLCall(); + } + + /// + /// This function applies a scale transformation to the current matrix. + /// + /// The amount to scale along x. + /// The amount to scale along y. + /// The amount to scale along z. + public void Scale(double x, double y, double z) + { + PreGLCall(); + glScaled(x, y, z); + PostGLCall(); + } + + /// + /// This function applies a scale transformation to the current matrix. + /// + /// The amount to scale along x. + /// The amount to scale along y. + /// The amount to scale along z. + public void Scale(float x, float y, float z) + { + PreGLCall(); + glScalef(x, y, z); + PostGLCall(); + } + + /// + /// Define the scissor box. + /// + /// Specify the lower left corner of the scissor box. Initially (0, 0). + /// Specify the lower left corner of the scissor box. Initially (0, 0). + /// Specify the width and height of the scissor box. When a GL context is first attached to a window, width and height are set to the dimensions of that window. + /// Specify the width and height of the scissor box. When a GL context is first attached to a window, width and height are set to the dimensions of that window. + public void Scissor (int x, int y, int width, int height) + { + PreGLCall(); + glScissor(x, y, width, height); + PostGLCall(); + } + + /// + /// This function sets the current select buffer. + /// + /// The size of the buffer you are passing. + /// The buffer itself. + public void SelectBuffer(int size, uint[] buffer) + { + PreGLCall(); + glSelectBuffer(size, buffer); + PostGLCall(); + } + + /// + /// Select flat or smooth shading. + /// + /// Specifies a symbolic value representing a shading technique. Accepted values are OpenGL.FLAT and OpenGL.SMOOTH. The default is OpenGL.SMOOTH. + public void ShadeModel (uint mode) + { + PreGLCall(); + glShadeModel(mode); + PostGLCall(); + } + + /// + /// Select flat or smooth shading. + /// + /// Specifies a symbolic value representing a shading technique. Accepted values are OpenGL.FLAT and OpenGL.SMOOTH. The default is OpenGL.SMOOTH. + public void ShadeModel(Enumerations.ShadeModel mode) + { + PreGLCall(); + glShadeModel((uint)mode); + PostGLCall(); + } + + /// + /// This function draws a sphere from a Quadric Object. + /// + /// The quadric object. + /// Sphere radius. + /// Slices of the sphere. + /// Stakcs of the sphere. + public void Sphere(IntPtr qobj, double radius, int slices, int stacks) + { + PreGLCall(); + gluSphere(qobj, radius, slices, stacks); + PostGLCall(); + } + + /// + /// This function sets the current stencil buffer function. + /// + /// The function type. + /// The function reference. + /// The function mask. + public void StencilFunc(uint func, int reference, uint mask) + { + PreGLCall(); + glStencilFunc(func, reference, mask); + PostGLCall(); + } + + /// + /// This function sets the current stencil buffer function. + /// + /// The function type. + /// The function reference. + /// The function mask. + public void StencilFunc(Enumerations.StencilFunction func, int reference, uint mask) + { + PreGLCall(); + glStencilFunc((uint)func, reference, mask); + PostGLCall(); + } + + /// + /// This function sets the stencil buffer mask. + /// + /// The mask. + public void StencilMask(uint mask) + { + PreGLCall(); + glStencilMask(mask); + PostGLCall(); + } + + /// + /// This function sets the stencil buffer operation. + /// + /// Fail operation. + /// Depth fail component. + /// Depth pass component. + public void StencilOp(uint fail, uint zfail, uint zpass) + { + PreGLCall(); + glStencilOp(fail, zfail, zpass); + PostGLCall(); + } + + /// + /// This function sets the stencil buffer operation. + /// + /// Fail operation. + /// Depth fail component. + /// Depth pass component. + public void StencilOp(Enumerations.StencilOperation fail, Enumerations.StencilOperation zfail, Enumerations.StencilOperation zpass) + { + PreGLCall(); + glStencilOp((uint)fail, (uint)zfail, (uint)zpass); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + public void TexCoord(double s) + { + PreGLCall(); + glTexCoord1d(s); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Array of 1,2,3 or 4 Texture Coordinates. + public void TexCoord(double []v) + { + PreGLCall(); + if(v.Length == 1) + glTexCoord1dv(v); + else if(v.Length == 2) + glTexCoord2dv(v); + else if(v.Length == 3) + glTexCoord3dv(v); + else if(v.Length == 4) + glTexCoord4dv(v); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + public void TexCoord(float s) + { + PreGLCall(); + glTexCoord1f(s); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. WARNING: if you + /// can call something more explicit, like TexCoord2f then call that, it's + /// much faster. + /// + /// Array of 1,2,3 or 4 Texture Coordinates. + public void TexCoord(float[] v) + { + PreGLCall(); + if(v.Length == 1) + glTexCoord1fv(v); + else if(v.Length == 2) + glTexCoord2fv(v); + else if(v.Length == 3) + glTexCoord3fv(v); + else if(v.Length == 4) + glTexCoord4fv(v); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + public void TexCoord(int s) + { + PreGLCall(); + glTexCoord1i(s); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Array of 1,2,3 or 4 Texture Coordinates. + public void TexCoord(int[] v) + { + PreGLCall(); + if(v.Length == 1) + glTexCoord1iv(v); + else if(v.Length == 2) + glTexCoord2iv(v); + else if(v.Length == 3) + glTexCoord3iv(v); + else if(v.Length == 4) + glTexCoord4iv(v); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + public void TexCoord(short s) + { + PreGLCall(); + glTexCoord1s(s); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Array of 1,2,3 or 4 Texture Coordinates. + public void TexCoord(short[] v) + { + PreGLCall(); + if(v.Length == 1) + glTexCoord1sv(v); + else if(v.Length == 2) + glTexCoord2sv(v); + else if(v.Length == 3) + glTexCoord3sv(v); + else if(v.Length == 4) + glTexCoord4sv(v); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(double s, double t) + { + PreGLCall(); + glTexCoord2d(s, t); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(float s, float t) + { + PreGLCall(); + glTexCoord2f(s, t); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(int s, int t) + { + PreGLCall(); + glTexCoord2i(s, t); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(short s, short t) + { + PreGLCall(); + glTexCoord2s(s, t); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(double s, double t, double r) + { + PreGLCall(); + glTexCoord3d(s, t, r); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(float s, float t, float r) + { + PreGLCall(); + glTexCoord3f(s, t, r); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(int s, int t, int r) + { + PreGLCall(); + glTexCoord3i(s, t, r); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(short s, short t, short r) + { + PreGLCall(); + glTexCoord3s(s, t, r); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(double s, double t, double r, double q) + { + PreGLCall(); + glTexCoord4d(s, t, r, q); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(float s, float t, float r, float q) + { + PreGLCall(); + glTexCoord4f(s, t, r, q); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(int s, int t, int r, int q) + { + PreGLCall(); + glTexCoord4i(s, t, r, q); + PostGLCall(); + } + + /// + /// This function sets the current texture coordinates. + /// + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + /// Texture Coordinate. + public void TexCoord(short s, short t, short r, short q) + { + PreGLCall(); + glTexCoord4s(s, t, r, q); + PostGLCall(); + } + + /// + /// This function sets the texture coord array. + /// + /// The number of coords per set. + /// The type of data. + /// The number of bytes between coords. + /// The coords. + public void TexCoordPointer(int size, uint type, int stride, IntPtr pointer) + { + PreGLCall(); + glTexCoordPointer(size, type, stride, pointer); + PostGLCall(); + } + + /// + /// This function sets the texture coord array. + /// + /// The number of coords per set. + /// The type of data. + /// The number of bytes between coords. + /// The coords. + public void TexCoordPointer(int size, uint type, int stride, float[] pointer) + { + PreGLCall(); + glTexCoordPointer(size, type, stride, pointer); + PostGLCall(); + } + + /// + /// Set texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a single-valued texture environment parameter. Must be OpenGL.TEXTURE_ENV_MODE. + /// Specifies a single symbolic constant, one of OpenGL.MODULATE, OpenGL.DECAL, OpenGL.BLEND, or OpenGL.REPLACE. + public void TexEnv(uint target, uint pname, float param) + { + PreGLCall(); + glTexEnvf(target, pname, param); + PostGLCall(); + } + + /// + /// Set texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a texture environment parameter. Accepted values are OpenGL.TEXTURE_ENV_MODE and OpenGL.TEXTURE_ENV_COLOR. + /// Specifies a pointer to a parameter array that contains either a single symbolic constant or an RGBA color. + public void TexEnv(uint target, uint pname, float[] parameters) + { + PreGLCall(); + glTexEnvfv(target, pname, parameters); + PostGLCall(); + } + + /// + /// Set texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a single-valued texture environment parameter. Must be OpenGL.TEXTURE_ENV_MODE. + /// Specifies a single symbolic constant, one of OpenGL.MODULATE, OpenGL.DECAL, OpenGL.BLEND, or OpenGL.REPLACE. + public void TexEnv(uint target, uint pname, int param) + { + PreGLCall(); + glTexEnvi(target, pname, param); + PostGLCall(); + } + + /// + /// Set texture environment parameters. + /// + /// Specifies a texture environment. Must be OpenGL.TEXTURE_ENV. + /// Specifies the symbolic name of a texture environment parameter. Accepted values are OpenGL.TEXTURE_ENV_MODE and OpenGL.TEXTURE_ENV_COLOR. + /// Specifies a pointer to a parameter array that contains either a single symbolic constant or an RGBA color. + public void TexEnv(uint target, uint pname, int[] parameters) + { + PreGLCall(); + glTexGeniv(target, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.GL_EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void TexGen(uint coord, uint pname, double param) + { + PreGLCall(); + glTexGend(coord, pname, param); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function or function parameters. Must be OpenGL.TEXTURE_GEN_MODE, OpenGL.OBJECT_PLANE, or OpenGL.EYE_PLANE. + /// Specifies a pointer to an array of texture generation parameters. If pname is OpenGL.TEXTURE_GEN_MODE, then the array must contain a single symbolic constant, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. Otherwise, params holds the coefficients for the texture-coordinate generation function specified by pname. + public void TexGen(uint coord, uint pname, double[] parameters) + { + PreGLCall(); + glTexGendv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.GL_EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void TexGen(uint coord, uint pname, float param) + { + PreGLCall(); + glTexGenf(coord, pname, param); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function or function parameters. Must be OpenGL.TEXTURE_GEN_MODE, OpenGL.OBJECT_PLANE, or OpenGL.EYE_PLANE. + /// Specifies a pointer to an array of texture generation parameters. If pname is OpenGL.TEXTURE_GEN_MODE, then the array must contain a single symbolic constant, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. Otherwise, params holds the coefficients for the texture-coordinate generation function specified by pname. + public void TexGen(uint coord, uint pname, float[] parameters) + { + PreGLCall(); + glTexGenfv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function. Must be OpenGL.TEXTURE_GEN_MODE. + /// Specifies a single-valued texture generation parameter, one of OpenGL.OBJECT_LINEAR, OpenGL.GL_EYE_LINEAR, or OpenGL.SPHERE_MAP. + public void TexGen(uint coord, uint pname, int param) + { + PreGLCall(); + glTexGeni(coord, pname, param); + PostGLCall(); + } + + /// + /// Control the generation of texture coordinates. + /// + /// Specifies a texture coordinate. Must be one of OpenGL.S, OpenGL.T, OpenGL.R, or OpenGL.Q. + /// Specifies the symbolic name of the texture-coordinate generation function or function parameters. Must be OpenGL.TEXTURE_GEN_MODE, OpenGL.OBJECT_PLANE, or OpenGL.EYE_PLANE. + /// Specifies a pointer to an array of texture generation parameters. If pname is OpenGL.TEXTURE_GEN_MODE, then the array must contain a single symbolic constant, one of OpenGL.OBJECT_LINEAR, OpenGL.EYE_LINEAR, or OpenGL.SPHERE_MAP. Otherwise, params holds the coefficients for the texture-coordinate generation function specified by pname. + public void TexGen(uint coord, uint pname, int[] parameters) + { + PreGLCall(); + glTexGeniv(coord, pname, parameters); + PostGLCall(); + } + + /// + /// This function sets the image for the currently binded texture. + /// + /// The type of texture, TEXTURE_2D or PROXY_TEXTURE_2D. + /// For mip-map textures, ordinary textures should be '0'. + /// The format of the data you are want OpenGL to create, e.g RGB16. + /// The width of the texture image (must be a power of 2, e.g 64). + /// The width of the border (0 or 1). + /// The format of the data you are passing, e.g. RGBA. + /// The type of data you are passing, e.g GL_BYTE. + /// The actual pixel data. + public void TexImage1D(uint target, int level, uint internalformat, int width, int border, uint format, uint type, byte[] pixels) + { + PreGLCall(); + glTexImage1D(target, level, internalformat, width, border, format, type, pixels); + PostGLCall(); + } + + /// + /// This function sets the image for the currently binded texture. + /// + /// The type of texture, TEXTURE_2D or PROXY_TEXTURE_2D. + /// For mip-map textures, ordinary textures should be '0'. + /// The format of the data you are want OpenGL to create, e.g RGB16. + /// The width of the texture image (must be a power of 2, e.g 64). + /// The height of the texture image (must be a power of 2, e.g 32). + /// The width of the border (0 or 1). + /// The format of the data you are passing, e.g. RGBA. + /// The type of data you are passing, e.g GL_BYTE. + /// The actual pixel data. + public void TexImage2D(uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, byte[] pixels) + { + PreGLCall(); + glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + PostGLCall(); + } + + /// + /// This function sets the image for the currently binded texture. + /// + /// The type of texture, TEXTURE_2D or PROXY_TEXTURE_2D. + /// For mip-map textures, ordinary textures should be '0'. + /// The format of the data you are want OpenGL to create, e.g RGB16. + /// The width of the texture image (must be a power of 2, e.g 64). + /// The height of the texture image (must be a power of 2, e.g 32). + /// The width of the border (0 or 1). + /// The format of the data you are passing, e.g. RGBA. + /// The type of data you are passing, e.g GL_BYTE. + /// The actual pixel data. + public void TexImage2D(uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, IntPtr pixels) + { + PreGLCall(); + glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(uint target, uint pname, float param) + { + PreGLCall(); + glTexParameterf(target, pname, param); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(Enumerations.TextureTarget target, Enumerations.TextureParameter pname, float param) + { + PreGLCall(); + glTexParameterf((uint)target, (uint)pname, param); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(uint target, uint pname, float[] parameters) + { + PreGLCall(); + glTexParameterfv(target, pname, parameters); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(Enumerations.TextureTarget target, Enumerations.TextureParameter pname, float[] parameters) + { + PreGLCall(); + glTexParameterfv((uint)target, (uint)pname, parameters); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(uint target, uint pname, int param) + { + PreGLCall(); + glTexParameteri(target, pname, param); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(Enumerations.TextureTarget target, Enumerations.TextureParameter pname, int param) + { + PreGLCall(); + glTexParameteri((uint)target, (uint)pname, param); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(uint target, uint pname, int[] parameters) + { + PreGLCall(); + glTexParameteriv(target, pname, parameters); + PostGLCall(); + } + + /// + /// This function sets the parameters for the currently binded texture object. + /// + /// The type of texture you are setting the parameter to, e.g. TEXTURE_2D + /// The parameter to set. + /// The value to set it to. + public void TexParameter(Enumerations.TextureTarget target, Enumerations.TextureParameter pname, int[] parameters) + { + PreGLCall(); + glTexParameteriv((uint)target, (uint)pname, parameters); + PostGLCall(); + } + + /// + /// Specify a two-dimensional texture subimage. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies a texel offset in the x direction within the texture array. + /// Specifies the width of the texture subimage. + /// Specifies the format of the pixel data. + /// Specifies the data type of the pixel data. + /// Specifies a pointer to the image data in memory. + public void TexSubImage1D(uint target, int level, int xoffset, int width, uint format, uint type, int[] pixels) + { + PreGLCall(); + glTexSubImage1D(target, level, xoffset, width, format, type, pixels); + PostGLCall(); + } + + /// + /// Specify a two-dimensional texture subimage. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image. + /// Specifies a texel offset in the x direction within the texture array. + /// Specifies a texel offset in the y direction within the texture array. + /// Specifies the width of the texture subimage. + /// Specifies the height of the texture subimage. + /// Specifies the format of the pixel data. + /// Specifies the data type of the pixel data. + /// Specifies a pointer to the image data in memory. + public void TexSubImage2D(uint target, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, int[] pixels) + { + PreGLCall(); + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + PostGLCall(); + } + + /// + /// This function applies a translation transformation to the current matrix. + /// + /// The amount to translate along the x axis. + /// The amount to translate along the y axis. + /// The amount to translate along the z axis. + public void Translate(double x, double y, double z) + { + PreGLCall(); + glTranslated(x, y, z); + PostGLCall(); + } + + /// + /// This function applies a translation transformation to the current matrix. + /// + /// The amount to translate along the x axis. + /// The amount to translate along the y axis. + /// The amount to translate along the z axis. + public void Translate(float x, float y, float z) + { + PreGLCall(); + glTranslatef(x, y, z); + PostGLCall(); + } + + /// + /// This function turns a screen Coordinate into a world coordinate. + /// + /// Screen Coordinate. + /// Screen Coordinate. + /// Screen Coordinate. + /// Current ModelView matrix. + /// Current Projection matrix. + /// Current Viewport. + /// The world coordinate. + /// The world coordinate. + /// The world coordinate. + public void UnProject(double winx, double winy, double winz, + double[] modelMatrix, double[] projMatrix, int[] viewport, + ref double objx, ref double objy, ref double objz) + { + PreGLCall(); + gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, + ref objx, ref objy, ref objz); + PostGLCall(); + } + + /// + /// This is a convenience function. It calls UnProject with the current + /// viewport, modelview and persective matricies, saving you from getting them. + /// To use you own matricies, all the other version of UnProject. + /// + /// X Coordinate (Screen Coordinate). + /// Y Coordinate (Screen Coordinate). + /// Z Coordinate (Screen Coordinate). + /// The world coordinate. + public double[] UnProject(double winx, double winy, double winz) + { + PreGLCall(); + + var modelview = new double[16]; + var projection = new double[16]; + var viewport = new int[4]; + GetDouble(GL_MODELVIEW_MATRIX, modelview); + GetDouble(GL_PROJECTION_MATRIX, projection); + GetInteger(GL_VIEWPORT, viewport); + var result = new double[3]; + gluUnProject(winx, winy, winz, modelview, projection, viewport, ref result[0], ref result[1], ref result[2]); + + PostGLCall(); + + return result; + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + public void Vertex(double x, double y) + { + PreGLCall(); + glVertex2d(x, y); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// Specifies the coordinate. + public void Vertex(double[] v) + { + PreGLCall(); + if (v.Length == 2) + glVertex2dv(v); + else if (v.Length == 3) + glVertex3dv(v); + else if (v.Length == 4) + glVertex4dv(v); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + public void Vertex(float x, float y) + { + PreGLCall(); + glVertex2f(x, y); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + public void Vertex(int x, int y) + { + PreGLCall(); + glVertex2i(x, y); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// Specifies the coordinate. + public void Vertex(int[] v) + { + PreGLCall(); + if (v.Length == 2) + glVertex2iv(v); + else if (v.Length == 3) + glVertex3iv(v); + else if (v.Length == 4) + glVertex4iv(v); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + public void Vertex(short x, short y) + { + PreGLCall(); + glVertex2s(x, y); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// Specifies the coordinate. + public void Vertex2sv(short[] v) + { + PreGLCall(); + if (v.Length == 2) + glVertex2sv(v); + else if (v.Length == 3) + glVertex3sv(v); + else if (v.Length == 4) + glVertex4sv(v); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + public void Vertex(double x, double y, double z) + { + PreGLCall(); + glVertex3d(x, y, z); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + public void Vertex(float x, float y, float z) + { + PreGLCall(); + glVertex3f(x, y, z); + PostGLCall(); + } + + /// + /// Sets the current vertex (must be called between 'Begin' and 'End'). + /// + /// An array of 2, 3 or 4 floats. + public void Vertex(float []v) + { + PreGLCall(); + if(v.Length == 2) + glVertex2fv(v); + else if(v.Length == 3) + glVertex3fv(v); + else if(v.Length == 4) + glVertex4fv(v); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + public void Vertex(int x, int y, int z) + { + PreGLCall(); + glVertex3i(x, y, z); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + public void Vertex(short x, short y, short z) + { + PreGLCall(); + glVertex3s(x, y, z); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + /// W Value. + public void Vertex4d(double x, double y, double z, double w) + { + PreGLCall(); + glVertex4d(x, y, z, w); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + /// W Value. + public void Vertex4f(float x, float y, float z, float w) + { + PreGLCall(); + glVertex4f(x, y, z, w); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + /// W Value. + public void Vertex4i(int x, int y, int z, int w) + { + PreGLCall(); + glVertex4i(x, y, z, w); + PostGLCall(); + } + + /// + /// Set the current vertex (must be called between 'Begin' and 'End'). + /// + /// X Value. + /// Y Value. + /// Z Value. + /// W Value. + public void Vertex4s(short x, short y, short z, short w) + { + PreGLCall(); + glVertex4s(x, y, z, w); + PostGLCall(); + } + + /// + /// This function sets the address of the vertex pointer array. + /// + /// The number of coords per vertex. + /// The data type. + /// The byte offset between vertices. + /// The array. + public void VertexPointer(int size, uint type, int stride, IntPtr pointer) + { + PreGLCall(); + glVertexPointer(size, type, stride, pointer); + PostGLCall(); + } + + /// + /// This function sets the address of the vertex pointer array. + /// + /// The number of coords per vertex. + /// The byte offset between vertices. + /// The array. + public void VertexPointer(int size, int stride, short[] pointer) + { + PreGLCall(); + glVertexPointer(size, GL_SHORT, stride, pointer); + PostGLCall(); + } + + /// + /// This function sets the address of the vertex pointer array. + /// + /// The number of coords per vertex. + /// The byte offset between vertices. + /// The array. + public void VertexPointer(int size, int stride, int[] pointer) + { + PreGLCall(); + glVertexPointer(size, GL_INT, stride, pointer); + PostGLCall(); + } + + /// + /// This function sets the address of the vertex pointer array. + /// + /// The number of coords per vertex. + /// The byte offset between vertices. + /// The array. + public void VertexPointer(int size, int stride, float[] pointer) + { + PreGLCall(); + glVertexPointer(size, GL_FLOAT, stride, pointer); + PostGLCall(); + } + + /// + /// This function sets the address of the vertex pointer array. + /// + /// The number of coords per vertex. + /// The byte offset between vertices. + /// The array. + public void VertexPointer(int size, int stride, double[] pointer) + { + PreGLCall(); + glVertexPointer(size, GL_DOUBLE, stride, pointer); + PostGLCall(); + } + + /// + /// This sets the viewport of the current Render Context. Normally x and y are 0 + /// and the width and height are just those of the control/graphics you are drawing + /// to. + /// + /// Top-Left point of the viewport. + /// Top-Left point of the viewport. + /// Width of the viewport. + /// Height of the viewport. + public void Viewport (int x, int y, int width, int height) + { + PreGLCall(); + glViewport(x, y, width, height); + PostGLCall(); + } + + /// + /// Produce an error string from a GL or GLU error code. + /// + /// Specifies a GL or GLU error code. + /// The OpenGL/GLU error string. + public unsafe string ErrorString(uint errCode) + { + PreGLCall(); + sbyte* pStr = gluErrorString(errCode); + var str = new string(pStr); + PostGLCall(); + + return str; + } + + /// + /// Return a string describing the GLU version or GLU extensions. + /// + /// Specifies a symbolic constant, one of OpenGL.VERSION, or OpenGL.EXTENSIONS. + /// The GLU string. + public unsafe string GetString(int name) + { + PreGLCall(); + sbyte* pStr = gluGetString(name); + var str = new string(pStr); + PostGLCall(); + + return str; + } + + /// + /// Scale an image to an arbitrary size. + /// + /// Specifies the format of the pixel data. + /// Specify the width of the source image that is scaled. + /// Specify the height of the source image that is scaled. + /// Specifies the data type for dataIn. + /// Specifies a pointer to the source image. + /// Specify the width of the destination image. + /// Specify the height of the destination image. + /// Specifies the data type for dataOut. + /// Specifies a pointer to the destination image. + public void ScaleImage(int format, int widthin, int heightin, int typein, int[] datain, int widthout, int heightout, int typeout, int[] dataout) + { + PreGLCall(); + gluScaleImage(format, widthin, heightin, typein, datain, widthout, heightout, typeout, dataout); + PostGLCall(); + } + + /// + /// Create 1-D mipmaps. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the number of color components in the texture. Must be 1, 2, 3, or 4. + /// Specifies the width of the texture image. + /// Specifies the format of the pixel data. + /// Specifies the data type for data. + /// Specifies a pointer to the image data in memory. + public void Build1DMipmaps(uint target, uint components, int width, uint format, uint type, IntPtr data) + { + PreGLCall(); + gluBuild1DMipmaps(target, components, width, format, type, data); + PostGLCall(); + } + + /// + /// Create 2-D mipmaps. + /// + /// Specifies the target texture. Must be OpenGL.TEXTURE_1D. + /// Specifies the number of color components in the texture. Must be 1, 2, 3, or 4. + /// Specifies the width of the texture image. + /// Specifies the height of the texture image. + /// Specifies the format of the pixel data. + /// Specifies the data type for data. + /// Specifies a pointer to the image data in memory. + public void Build2DMipmaps(uint target, uint components, int width, int height, uint format, uint type, IntPtr data) + { + PreGLCall(); + gluBuild2DMipmaps(target, components, width, height, format, type, data); + PostGLCall(); + } + + /// + /// Draw a disk. + /// + /// Specifies the quadrics object (created with gluNewQuadric). + /// Specifies the inner radius of the disk (may be 0). + /// Specifies the outer radius of the disk. + /// Specifies the number of subdivisions around the z axis. + /// Specifies the number of concentric rings about the origin into which the disk is subdivided. + public void Disk(IntPtr qobj, double innerRadius, double outerRadius, int slices, int loops) + { + PreGLCall(); + gluDisk(qobj, innerRadius, outerRadius, slices, loops); + PostGLCall(); + } + + /// + /// Create a tessellation object. + /// + /// A new GLUtesselator poiner. + public IntPtr NewTess() + { + PreGLCall(); + IntPtr returnValue = gluNewTess(); + PostGLCall(); + + return returnValue; + } + + /// + /// Delete a tesselator object. + /// + /// The tesselator pointer. + public void DeleteTess(IntPtr tess) + { + PreGLCall(); + gluDeleteTess(tess); + PostGLCall(); + } + + /// + /// Delimit a polygon description. + /// + /// Specifies the tessellation object (created with gluNewTess). + /// Specifies a pointer to user polygon data. + public void TessBeginPolygon(IntPtr tess, IntPtr polygonData) + { + PreGLCall(); + gluTessBeginPolygon(tess, polygonData); + PostGLCall(); + } + + /// + /// Delimit a contour description. + /// + /// Specifies the tessellation object (created with gluNewTess). + public void TessBeginContour(IntPtr tess) + { + PreGLCall(); + gluTessBeginContour(tess); + } + + /// + /// Specify a vertex on a polygon. + /// + /// Specifies the tessellation object (created with gluNewTess). + /// Specifies the location of the vertex. + /// Specifies an opaque pointer passed back to the program with the vertex callback (as specified by gluTessCallback). + public void TessVertex(IntPtr tess, double[] coords, double[] data) + { + PreGLCall(); + gluTessVertex(tess, coords, data); + PostGLCall(); + } + + /// + /// Delimit a contour description. + /// + /// Specifies the tessellation object (created with gluNewTess). + public void TessEndContour(IntPtr tess) + { + PreGLCall(); + gluTessEndContour(tess); + PostGLCall(); + } + + /// + /// Delimit a polygon description. + /// + /// Specifies the tessellation object (created with gluNewTess). + public void TessEndPolygon(IntPtr tess) + { + PreGLCall(); + gluTessEndPolygon(tess); + PostGLCall(); + } + + /// + /// Set a tessellation object property. + /// + /// Specifies the tessellation object (created with gluNewTess). + /// Specifies the property to be set. + /// Specifies the value of the indicated property. + public void TessProperty(IntPtr tess, int which, double value) + { + PreGLCall(); + gluTessProperty(tess, which, value); + PostGLCall(); + } + + /// + /// Specify a normal for a polygon. + /// + /// Specifies the tessellation object (created with gluNewTess). + /// Specifies the first component of the normal. + /// Specifies the second component of the normal. + /// Specifies the third component of the normal. + public void TessNormal(IntPtr tess, double x, double y, double z) + { + PreGLCall(); + gluTessNormal(tess, x, y, z); + PostGLCall(); + } + + /// + /// Set a tessellation object property. + /// + /// Specifies the tessellation object (created with gluNewTess). + /// Specifies the property to be set. + /// Specifies the value of the indicated property. + public void GetTessProperty(IntPtr tess, int which, double value) + { + PreGLCall(); + gluGetTessProperty(tess, which, value); + PostGLCall(); + } + + /// + /// Delimit a NURBS trimming loop definition. + /// + /// Specifies the NURBS object (created with gluNewNurbsRenderer). + public void BeginTrim(IntPtr nobj) + { + PreGLCall(); + gluBeginTrim(nobj); + PostGLCall(); + } + + /// + /// Delimit a NURBS trimming loop definition. + /// + /// Specifies the NURBS object (created with gluNewNurbsRenderer). + public void EndTrim(IntPtr nobj) + { + PreGLCall(); + gluEndTrim(nobj); + PostGLCall(); + } + + /// + /// Describe a piecewise linear NURBS trimming curve. + /// + /// Specifies the NURBS object (created with gluNewNurbsRenderer). + /// Specifies the number of points on the curve. + /// Specifies an array containing the curve points. + /// Specifies the offset (a number of single-precision floating-point values) between points on the curve. + /// Specifies the type of curve. Must be either OpenGL.MAP1_TRIM_2 or OpenGL.MAP1_TRIM_3. + public void PwlCurve(IntPtr nobj, int count, float array, int stride, uint type) + { + PreGLCall(); + gluPwlCurve(nobj, count, array, stride, type); + PostGLCall(); + } + + /// + /// Load NURBS sampling and culling matrice. + /// + /// Specifies the NURBS object (created with gluNewNurbsRenderer). + /// Specifies a modelview matrix (as from a glGetFloatv call). + /// Specifies a projection matrix (as from a glGetFloatv call). + /// Specifies a viewport (as from a glGetIntegerv call). + public void LoadSamplingMatrices(IntPtr nobj, float[] modelMatrix, float[] projMatrix, int[] viewport) + { + PreGLCall(); + gluLoadSamplingMatrices(nobj, modelMatrix, projMatrix, viewport); + PostGLCall(); + } + + /// + /// Get a NURBS property. + /// + /// Specifies the NURBS object (created with gluNewNurbsRenderer). + /// Specifies the property whose value is to be fetched. + /// Specifies a pointer to the location into which the value of the named property is written. + public void GetNurbsProperty(IntPtr nobj, int property, float value) + { + PreGLCall(); + gluGetNurbsProperty(nobj, property, value); + PostGLCall(); + } + + #endregion + + #region Error Checking + + /// + /// Gets the error description for a given error code. + /// + /// The error code. + /// The error description for the given error code. + public string GetErrorDescription(uint errorCode) + { + switch (errorCode) + { + case GL_NO_ERROR: + return "No Error"; + case GL_INVALID_ENUM: + return "A GLenum argument was out of range."; + case GL_INVALID_VALUE: + return "A numeric argument was out of range."; + case GL_INVALID_OPERATION: + return "Invalid operation."; + case GL_STACK_OVERFLOW: + return "Command would cause a stack overflow."; + case GL_STACK_UNDERFLOW: + return "Command would cause a stack underflow."; + case GL_OUT_OF_MEMORY: + return "Not enough memory left to execute command."; + default: + return "Unknown Error"; + } + } + + /// + /// Called before an OpenGL call to enable error checking and ensure the + /// correct OpenGL context is correct. + /// + protected virtual void PreGLCall() + { + // If we are in debug mode, clear the error flag. +#if DEBUG + // GetError() should not be called at all inside glBegin-glEnd +if (insideGLBegin == false) +{ + GetError(); + } +#endif + + // If we are not the current OpenGL object, make ourselves current. + if (currentOpenGLInstance != this) + { + MakeCurrent(); + } + } + + /// + /// Called after an OpenGL call to enable error checking. + /// + protected virtual void PostGLCall() + { +#if DEBUG + // We can only perform the following error check if we + // are not in a glBegin function. + if (insideGLBegin == false) + { + // This error check is very useful, as you can break anytime + // an OpenGL error occurs, going through a program with this on + // can rid it of bugs. It's VERY slow though, as every call is monitored. + uint errorCode = GetError(); + + // What error is it? + if (errorCode != GL_NO_ERROR) + { + // Get the error message. + var errorMessage = GetErrorDescription(errorCode); + + // Create a stack trace. + var stackTrace = new StackTrace(); + + // Get the stack frames. + var stackFrames = stackTrace.GetFrames(); + + // Write the error to the trace log. + var functionName = (stackFrames != null && stackFrames.Length > 1) ? stackFrames[1].GetMethod().Name : "Unknown Function"; + Trace.WriteLine("OpenGL Error: \"" + errorMessage + "\", when calling function SharpGL." + functionName); + } + } +#endif + } + + #endregion + + #region Utility Functions + + /// + /// This function transforms a windows point into an OpenGL point, + /// which is measured from the bottom left of the screen. + /// + /// The x coord. + /// The y coord. + public void GDItoOpenGL(ref int x, ref int y) + { + // Create an array that will be the viewport. + var viewport = new int[4]; + + // Get the viewport, then convert the mouse point to an opengl point. + GetInteger(GL_VIEWPORT, viewport); + y = viewport[3] - y; + } + + #endregion + + /// + /// Creates the OpenGL instance. + /// + /// The OpenGL version requested. + /// Type of the render context. + /// The drawing context width. + /// The drawing context height. + /// The bit depth. + /// The parameter. + /// + public virtual bool Create(OpenGLVersion openGLVersion, RenderContextType renderContextType, int width, int height, int bitDepth, object parameter) + { + // Return if we don't have a sensible width or height. + if(width == 0 || height == 0 || bitDepth == 0) + return false; + + // Create an instance of the render context provider. + switch(renderContextType) + { + case RenderContextType.DIBSection: + renderContextProvider = new DIBSectionRenderContextProvider(); + break; + case RenderContextType.NativeWindow: + renderContextProvider = new NativeWindowRenderContextProvider(); + break; + case RenderContextType.HiddenWindow: + renderContextProvider = new HiddenWindowRenderContextProvider(); + break; + case RenderContextType.FBO: + renderContextProvider = new FBORenderContextProvider(); + break; + } + + // Create the render context. + renderContextProvider.Create(openGLVersion, this, width, height, bitDepth, parameter); + + return true; + } + + /// + /// Creates the OpenGL instance using an external, existing render context. + /// + /// The OpenGL version requested. + /// The width. + /// The height. + /// The bit depth. + /// The window handle. + /// The render context handle. + /// The device context handle. + /// + /// True on success + /// + public virtual bool CreateFromExternalContext(OpenGLVersion openGLVersion, int width, int height, int bitDepth, IntPtr windowHandle, IntPtr renderContextHandle, IntPtr deviceContextHandle) + { + // Return if we don't have a sensible width or height. + if (width == 0 || height == 0 || bitDepth == 0) + { + return false; + } + + renderContextProvider = new ExternalRenderContextProvider(windowHandle, renderContextHandle, deviceContextHandle); + renderContextProvider.Create(openGLVersion, this, width, height, bitDepth, null); + + return true; + } + + /// + /// Makes the OpenGL instance current. + /// + public virtual void MakeCurrent() + { + // As long as we have a render context provider, make it current. + if (renderContextProvider != null) + { + renderContextProvider.MakeCurrent(); + currentOpenGLInstance = this; + } + } + + /// + /// Makes no render context current. + /// + public virtual void MakeNothingCurrent() + { + Win32.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero); + } + + /// + /// Blits to the specified device context handle. + /// + /// The device context handle. + public virtual void Blit(IntPtr deviceContextHandle) + { + // As long as we have a render context provider, blit to it. + if(renderContextProvider != null) + renderContextProvider.Blit(deviceContextHandle); + } + + /// + /// Set the render context dimensions. + /// + /// The width (in pixels). + /// The height (in pixels). + public virtual void SetDimensions(int width, int height) + { + if(renderContextProvider != null) + renderContextProvider.SetDimensions(width, height); + } + + /// + /// GDIs the coordinateto open GL coordinate. + /// + /// The x coordinate. + /// The y coordinate. + public virtual void GDICoordinatetoOpenGLCoordinate(ref int x, ref int y) + { + // Create an array that will be the viewport. + var viewport = new int[4]; + + // Get the viewport, then convert the mouse point to an opengl point. + glGetIntegerv(GL_VIEWPORT, viewport); + y = viewport[3] - y; + } + + /// + /// Draws the text. + /// + /// The x. + /// The y. + /// The r. + /// The g. + /// The b. + /// Name of the face. + /// Size of the font. + /// The text. + public void DrawText(int x, int y, float r, float g, float b, + string faceName, float fontSize, string text) + { + // Use the font bitmaps object to render the text. + fontBitmaps.DrawText(this, x, y, r, g, b, faceName, fontSize, text); + } + + /// + /// Draws 3D text. + /// + /// Name of the face. + /// Size of the font. + /// The deviation. + /// The extrusion. + /// The text. + public void DrawText3D(string faceName, float fontSize, float deviation, float extrusion, string text) + { + // Use the font outlines object to render the text. + fontOutlines.DrawText(this, faceName, fontSize, deviation, extrusion, text); + } + + #region Member Variables + + /// + /// The current OpenGL instance. + /// + private static OpenGL currentOpenGLInstance; + + /// + /// The render context provider. + /// + private IRenderContextProvider renderContextProvider; + + /// + /// Set to true if we're inside glBegin. + /// + private bool insideGLBegin; + + /// + /// The fontbitmaps object is used to allow easy rendering of text. + /// + private readonly FontBitmaps fontBitmaps = new FontBitmaps(); + + /// + /// The FontOutlines object is used to allow rendering of text. + /// + private readonly FontOutlines fontOutlines = new FontOutlines(); + + #endregion + + #region Properties + + /// + /// Gets the render context provider. + /// + /// The render context provider. + public IRenderContextProvider RenderContextProvider + { + get { return renderContextProvider; } + } + + /// + /// Gets the vendor. + /// + /// The vendor. + public string Vendor + { + get { return GetString(GL_VENDOR); } + } + + /// + /// Gets the renderer. + /// + /// The renderer. + public string Renderer + { + get { return GetString(GL_RENDERER); } + } + + /// + /// Gets the version. + /// + /// The version. + public string Version + { + get { return GetString(GL_VERSION); } + } + + /// + /// Gets the extensions. + /// + /// The extensions. + public string Extensions + { + get { return GetString(GL_EXTENSIONS); } + } + + + + #endregion + } +} diff --git a/src/SharpGL/OpenGLExtensions.cs b/src/SharpGL/OpenGLExtensions.cs new file mode 100644 index 0000000..71e2593 --- /dev/null +++ b/src/SharpGL/OpenGLExtensions.cs @@ -0,0 +1,5841 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace SharpGL +{ + public partial class OpenGL + { + /// + /// Determines whether a named extension function is supported. + /// + /// Name of the extension function. + /// + /// true if the extension function is supported; otherwise, false. + /// + public bool IsExtensionFunctionSupported(string extensionFunctionName) + { + // Try and get the proc address for the function. + IntPtr procAddress = Win32.wglGetProcAddress(extensionFunctionName); + + // As long as the pointer is non-zero, we can invoke the extension function. + return procAddress != IntPtr.Zero; + } + + /// + /// Returns a delegate for an extension function. This delegate can be called to execute the extension function. + /// + /// The extension delegate type. + /// The delegate that points to the extension function. + private T GetDelegateFor() where T : class + { + // Get the type of the extension function. + Type delegateType = typeof(T); + + // Get the name of the extension function. + string name = delegateType.Name; + + // ftlPhysicsGuy - Better way + Delegate del = null; + if (extensionFunctions.TryGetValue(name, out del) == false) + { + IntPtr proc = Win32.wglGetProcAddress(name); + if (proc == IntPtr.Zero) + throw new Exception("Extension function " + name + " not supported"); + + // Get the delegate for the function pointer. + del = Marshal.GetDelegateForFunctionPointer(proc, delegateType); + + // Add to the dictionary. + extensionFunctions.Add(name, del); + } + + return del as T; + } + + /// + /// The set of extension functions. + /// + private Dictionary extensionFunctions = new Dictionary(); + + #region OpenGL 1.2 + + // Methods + public void BlendColor(float red, float green, float blue, float alpha) + { + GetDelegateFor()(red, green, blue, alpha); + } + public void BlendEquation(uint mode) + { + GetDelegateFor()(mode); + } + public void DrawRangeElements(uint mode, uint start, uint end, int count, uint type, IntPtr indices) + { + GetDelegateFor()(mode, start, end, count, type, indices); + } + public void TexImage3D(uint target, int level, int internalformat, int width, int height, int depth, int border, uint format, uint type, IntPtr pixels) + { + GetDelegateFor()(target, level, internalformat, width, height, depth, border, format, type, pixels); + } + public void TexSubImage3D(uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, IntPtr pixels) + { + GetDelegateFor()(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + } + public void CopyTexSubImage3D(uint target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height) + { + GetDelegateFor()(target, level, xoffset, yoffset, zoffset, x, y, width, height); + } + + // Deprecated Methods + [Obsolete] + public void ColorTable(uint target, uint internalformat, int width, uint format, uint type, IntPtr table) + { + GetDelegateFor()(target, internalformat, width, format, type, table); + } + [Obsolete] + public void ColorTableParameterfv(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void ColorTableParameteriv(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void CopyColorTable(uint target, uint internalformat, int x, int y, int width) + { + GetDelegateFor()(target, internalformat, x, y, width); + } + [Obsolete] + public void GetColorTable(uint target, uint format, uint type, IntPtr table) + { + GetDelegateFor()(target, format, type, table); + } + [Obsolete] + public void GetColorTableParameter(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetColorTableParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void ColorSubTable(uint target, int start, int count, uint format, uint type, IntPtr data) + { + GetDelegateFor()(target, start, count, format, type, data); + } + [Obsolete] + public void CopyColorSubTable(uint target, int start, int x, int y, int width) + { + GetDelegateFor()(target, start, x, y, width); + } + [Obsolete] + public void ConvolutionFilter1D(uint target, uint internalformat, int width, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, internalformat, width, format, type, image); + } + [Obsolete] + public void ConvolutionFilter2D(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, internalformat, width, height, format, type, image); + } + [Obsolete] + public void ConvolutionParameter(uint target, uint pname, float parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void ConvolutionParameter(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void ConvolutionParameter(uint target, uint pname, int parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void ConvolutionParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void CopyConvolutionFilter1D(uint target, uint internalformat, int x, int y, int width) + { + GetDelegateFor()(target, internalformat, x, y, width); + } + [Obsolete] + public void CopyConvolutionFilter2D(uint target, uint internalformat, int x, int y, int width, int height) + { + GetDelegateFor()(target, internalformat, x, y, width, height); + } + [Obsolete] + public void GetConvolutionFilter(uint target, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, format, type, image); + } + [Obsolete] + public void GetConvolutionParameter(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetConvolutionParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetSeparableFilter(uint target, uint format, uint type, IntPtr row, IntPtr column, IntPtr span) + { + GetDelegateFor()(target, format, type, row, column, span); + } + [Obsolete] + public void SeparableFilter2D(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr row, IntPtr column) + { + GetDelegateFor()(target, internalformat, width, height, format, type, row, column); + } + [Obsolete] + public void GetHistogram(uint target, bool reset, uint format, uint type, IntPtr values) + { + GetDelegateFor()(target, reset, format, type, values); + } + [Obsolete] + public void GetHistogramParameter(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetHistogramParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetMinmax(uint target, bool reset, uint format, uint type, IntPtr values) + { + GetDelegateFor()(target, reset, format, type, values); + } + [Obsolete] + public void GetMinmaxParameter(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void GetMinmaxParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + [Obsolete] + public void Histogram(uint target, int width, uint internalformat, bool sink) + { + GetDelegateFor()(target, width, internalformat, sink); + } + [Obsolete] + public void Minmax(uint target, uint internalformat, bool sink) + { + GetDelegateFor()(target, internalformat, sink); + } + [Obsolete] + public void ResetHistogram(uint target) + { + GetDelegateFor()(target); + } + [Obsolete] + public void ResetMinmax(uint target) + { + GetDelegateFor()(target); + } + + // Delegates + private delegate void glBlendColor (float red, float green, float blue, float alpha); + private delegate void glBlendEquation (uint mode); + private delegate void glDrawRangeElements (uint mode, uint start, uint end, int count, uint type, IntPtr indices); + private delegate void glTexImage3D (uint target, int level, int internalformat, int width, int height, int depth, int border, uint format, uint type, IntPtr pixels); + private delegate void glTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, IntPtr pixels); + private delegate void glCopyTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height); + private delegate void glColorTable (uint target, uint internalformat, int width, uint format, uint type, IntPtr table); + private delegate void glColorTableParameterfv (uint target, uint pname, float[] parameters); + private delegate void glColorTableParameteriv (uint target, uint pname, int[] parameters); + private delegate void glCopyColorTable (uint target, uint internalformat, int x, int y, int width); + private delegate void glGetColorTable (uint target, uint format, uint type, IntPtr table); + private delegate void glGetColorTableParameterfv (uint target, uint pname, float[] parameters); + private delegate void glGetColorTableParameteriv (uint target, uint pname, int[] parameters); + private delegate void glColorSubTable (uint target, int start, int count, uint format, uint type, IntPtr data); + private delegate void glCopyColorSubTable (uint target, int start, int x, int y, int width); + private delegate void glConvolutionFilter1D (uint target, uint internalformat, int width, uint format, uint type, IntPtr image); + private delegate void glConvolutionFilter2D (uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr image); + private delegate void glConvolutionParameterf (uint target, uint pname, float parameters); + private delegate void glConvolutionParameterfv (uint target, uint pname, float[] parameters); + private delegate void glConvolutionParameteri (uint target, uint pname, int parameters); + private delegate void glConvolutionParameteriv (uint target, uint pname, int[] parameters); + private delegate void glCopyConvolutionFilter1D (uint target, uint internalformat, int x, int y, int width); + private delegate void glCopyConvolutionFilter2D (uint target, uint internalformat, int x, int y, int width, int height); + private delegate void glGetConvolutionFilter (uint target, uint format, uint type, IntPtr image); + private delegate void glGetConvolutionParameterfv (uint target, uint pname, float[] parameters); + private delegate void glGetConvolutionParameteriv (uint target, uint pname, int[] parameters); + private delegate void glGetSeparableFilter (uint target, uint format, uint type, IntPtr row, IntPtr column, IntPtr span); + private delegate void glSeparableFilter2D (uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr row, IntPtr column); + private delegate void glGetHistogram (uint target, bool reset, uint format, uint type, IntPtr values); + private delegate void glGetHistogramParameterfv (uint target, uint pname, float[] parameters); + private delegate void glGetHistogramParameteriv (uint target, uint pname, int[] parameters); + private delegate void glGetMinmax (uint target, bool reset, uint format, uint type, IntPtr values); + private delegate void glGetMinmaxParameterfv (uint target, uint pname, float[] parameters); + private delegate void glGetMinmaxParameteriv (uint target, uint pname, int[] parameters); + private delegate void glHistogram (uint target, int width, uint internalformat, bool sink); + private delegate void glMinmax (uint target, uint internalformat, bool sink); + private delegate void glResetHistogram (uint target); + private delegate void glResetMinmax (uint target); + + // Constants + public const uint GL_UNSIGNED_BYTE_3_3_2 = 0x8032; + public const uint GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; + public const uint GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; + public const uint GL_UNSIGNED_INT_8_8_8_8 = 0x8035; + public const uint GL_UNSIGNED_INT_10_10_10_2 = 0x8036; + public const uint GL_TEXTURE_BINDING_3D = 0x806A; + public const uint GL_PACK_SKIP_IMAGES = 0x806B; + public const uint GL_PACK_IMAGE_HEIGHT = 0x806C; + public const uint GL_UNPACK_SKIP_IMAGES = 0x806D; + public const uint GL_UNPACK_IMAGE_HEIGHT = 0x806E; + public const uint GL_TEXTURE_3D = 0x806F; + public const uint GL_PROXY_TEXTURE_3D = 0x8070; + public const uint GL_TEXTURE_DEPTH = 0x8071; + public const uint GL_TEXTURE_WRAP_R = 0x8072; + public const uint GL_MAX_3D_TEXTURE_SIZE = 0x8073; + public const uint GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362; + public const uint GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + public const uint GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364; + public const uint GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365; + public const uint GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366; + public const uint GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; + public const uint GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; + public const uint GL_BGR = 0x80E0; + public const uint GL_BGRA = 0x80E1; + public const uint GL_MAX_ELEMENTS_VERTICES = 0x80E8; + public const uint GL_MAX_ELEMENTS_INDICES = 0x80E9; + public const uint GL_CLAMP_TO_EDGE = 0x812F; + public const uint GL_TEXTURE_MIN_LOD = 0x813A; + public const uint GL_TEXTURE_MAX_LOD = 0x813B; + public const uint GL_TEXTURE_BASE_LEVEL = 0x813C; + public const uint GL_TEXTURE_MAX_LEVEL = 0x813D; + public const uint GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; + public const uint GL_SMOOTH_POINT_SIZE_GRANULARITY = 0x0B13; + public const uint GL_SMOOTH_LINE_WIDTH_RANGE = 0x0B22; + public const uint GL_SMOOTH_LINE_WIDTH_GRANULARITY = 0x0B23; + public const uint GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; + + #endregion + + #region OpenGL 1.3 + + // Methods + + + public void ActiveTexture(uint texture) + { + GetDelegateFor()(texture); + } + public void SampleCoverage(float value, bool invert) + { + GetDelegateFor()(value, invert); + } + public void CompressedTexImage3D(uint target, int level, uint internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, height, depth, border, imageSize, data); + } + public void CompressedTexImage2D(uint target, int level, uint internalformat, int width, int height, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, height, border, imageSize, data); + } + public void CompressedTexImage1D(uint target, int level, uint internalformat, int width, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, border, imageSize, data); + } + public void CompressedTexSubImage3D(uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + } + public void CompressedTexSubImage2D(uint target, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, yoffset, width, height, format, imageSize, data); + } + public void CompressedTexSubImage1D(uint target, int level, int xoffset, int width, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, width, format, imageSize, data); + } + public void GetCompressedTexImage(uint target, int level, IntPtr img) + { + GetDelegateFor()(target, level, img); + } + + // Deprecated Methods + [Obsolete] + public void ClientActiveTexture(uint texture) + { + GetDelegateFor()(texture); + } + [Obsolete] + public void MultiTexCoord1(uint target, double s) + { + GetDelegateFor()(target, s); + } + [Obsolete] + public void MultiTexCoord1(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord1(uint target, float s) + { + GetDelegateFor()(target, s); + } + [Obsolete] + public void MultiTexCoord1(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord1(uint target, int s) + { + GetDelegateFor()(target, s); + } + [Obsolete] + public void MultiTexCoord1(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord1(uint target, short s) + { + GetDelegateFor()(target, s); + } + [Obsolete] + public void MultiTexCoord1(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord2(uint target, double s, double t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete] + public void MultiTexCoord2(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord2(uint target, float s, float t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete] + public void MultiTexCoord2(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord2(uint target, int s, int t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete] + public void MultiTexCoord2(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord2(uint target, short s, short t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete] + public void MultiTexCoord2(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord3(uint target, double s, double t, double r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete] + public void MultiTexCoord3(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord3(uint target, float s, float t, float r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete] + public void MultiTexCoord3(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord3(uint target, int s, int t, int r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete] + public void MultiTexCoord3(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord3(uint target, short s, short t, short r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete] + public void MultiTexCoord3(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord4(uint target, double s, double t, double r, double q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete] + public void MultiTexCoord4(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord4(uint target, float s, float t, float r, float q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete] + public void MultiTexCoord4(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord4(uint target, int s, int t, int r, int q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete] + public void MultiTexCoord4(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void MultiTexCoord4(uint target, short s, short t, short r, short q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete] + public void MultiTexCoord4(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete] + public void LoadTransposeMatrix(float[] m) + { + GetDelegateFor()(m); + } + [Obsolete] + public void LoadTransposeMatrix(double[] m) + { + GetDelegateFor()(m); + } + [Obsolete] + public void MultTransposeMatrix(float[] m) + { + GetDelegateFor()(m); + } + [Obsolete] + public void MultTransposeMatrix(double[] m) + { + GetDelegateFor()(m); + } + + // Delegates + private delegate void glActiveTexture (uint texture); + private delegate void glSampleCoverage (float value, bool invert); + private delegate void glCompressedTexImage3D (uint target, int level, uint internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexImage2D (uint target, int level, uint internalformat, int width, int height, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexImage1D (uint target, int level, uint internalformat, int width, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage3D (uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage2D (uint target, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage1D (uint target, int level, int xoffset, int width, uint format, int imageSize, IntPtr data); + private delegate void glGetCompressedTexImage (uint target, int level, IntPtr img); + + private delegate void glClientActiveTexture (uint texture); + private delegate void glMultiTexCoord1d (uint target, double s); + private delegate void glMultiTexCoord1dv (uint target, double[] v); + private delegate void glMultiTexCoord1f (uint target, float s); + private delegate void glMultiTexCoord1fv (uint target, float[] v); + private delegate void glMultiTexCoord1i (uint target, int s); + private delegate void glMultiTexCoord1iv (uint target, int[] v); + private delegate void glMultiTexCoord1s (uint target, short s); + private delegate void glMultiTexCoord1sv (uint target, short[] v); + private delegate void glMultiTexCoord2d (uint target, double s, double t); + private delegate void glMultiTexCoord2dv (uint target, double[] v); + private delegate void glMultiTexCoord2f (uint target, float s, float t); + private delegate void glMultiTexCoord2fv (uint target, float[] v); + private delegate void glMultiTexCoord2i (uint target, int s, int t); + private delegate void glMultiTexCoord2iv (uint target, int[] v); + private delegate void glMultiTexCoord2s (uint target, short s, short t); + private delegate void glMultiTexCoord2sv (uint target, short[] v); + private delegate void glMultiTexCoord3d (uint target, double s, double t, double r); + private delegate void glMultiTexCoord3dv (uint target, double[] v); + private delegate void glMultiTexCoord3f (uint target, float s, float t, float r); + private delegate void glMultiTexCoord3fv (uint target, float[] v); + private delegate void glMultiTexCoord3i (uint target, int s, int t, int r); + private delegate void glMultiTexCoord3iv (uint target, int[] v); + private delegate void glMultiTexCoord3s (uint target, short s, short t, short r); + private delegate void glMultiTexCoord3sv (uint target, short[] v); + private delegate void glMultiTexCoord4d (uint target, double s, double t, double r, double q); + private delegate void glMultiTexCoord4dv (uint target, double[] v); + private delegate void glMultiTexCoord4f (uint target, float s, float t, float r, float q); + private delegate void glMultiTexCoord4fv (uint target, float[] v); + private delegate void glMultiTexCoord4i (uint target, int s, int t, int r, int q); + private delegate void glMultiTexCoord4iv (uint target, int[] v); + private delegate void glMultiTexCoord4s (uint target, short s, short t, short r, short q); + private delegate void glMultiTexCoord4sv (uint target, short[] v); + private delegate void glLoadTransposeMatrixf (float[] m); + private delegate void glLoadTransposeMatrixd (double[] m); + private delegate void glMultTransposeMatrixf (float[] m); + private delegate void glMultTransposeMatrixd (double[] m); + + // Constants + public const uint GL_TEXTURE0 = 0x84C0; + public const uint GL_TEXTURE1 = 0x84C1; + public const uint GL_TEXTURE2 = 0x84C2; + public const uint GL_TEXTURE3 = 0x84C3; + public const uint GL_TEXTURE4 = 0x84C4; + public const uint GL_TEXTURE5 = 0x84C5; + public const uint GL_TEXTURE6 = 0x84C6; + public const uint GL_TEXTURE7 = 0x84C7; + public const uint GL_TEXTURE8 = 0x84C8; + public const uint GL_TEXTURE9 = 0x84C9; + public const uint GL_TEXTURE10 = 0x84CA; + public const uint GL_TEXTURE11 = 0x84CB; + public const uint GL_TEXTURE12 = 0x84CC; + public const uint GL_TEXTURE13 = 0x84CD; + public const uint GL_TEXTURE14 = 0x84CE; + public const uint GL_TEXTURE15 = 0x84CF; + public const uint GL_TEXTURE16 = 0x84D0; + public const uint GL_TEXTURE17 = 0x84D1; + public const uint GL_TEXTURE18 = 0x84D2; + public const uint GL_TEXTURE19 = 0x84D3; + public const uint GL_TEXTURE20 = 0x84D4; + public const uint GL_TEXTURE21 = 0x84D5; + public const uint GL_TEXTURE22 = 0x84D6; + public const uint GL_TEXTURE23 = 0x84D7; + public const uint GL_TEXTURE24 = 0x84D8; + public const uint GL_TEXTURE25 = 0x84D9; + public const uint GL_TEXTURE26 = 0x84DA; + public const uint GL_TEXTURE27 = 0x84DB; + public const uint GL_TEXTURE28 = 0x84DC; + public const uint GL_TEXTURE29 = 0x84DD; + public const uint GL_TEXTURE30 = 0x84DE; + public const uint GL_TEXTURE31 = 0x84DF; + public const uint GL_ACTIVE_TEXTURE = 0x84E0; + public const uint GL_MULTISAMPLE = 0x809D; + public const uint GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + public const uint GL_SAMPLE_ALPHA_TO_ONE = 0x809F; + public const uint GL_SAMPLE_COVERAGE = 0x80A0; + public const uint GL_SAMPLE_BUFFERS = 0x80A8; + public const uint GL_SAMPLES = 0x80A9; + public const uint GL_SAMPLE_COVERAGE_VALUE = 0x80AA; + public const uint GL_SAMPLE_COVERAGE_INVERT = 0x80AB; + public const uint GL_TEXTURE_CUBE_MAP = 0x8513; + public const uint GL_TEXTURE_BINDING_CUBE_MAP = 0x8514; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + public const uint GL_PROXY_TEXTURE_CUBE_MAP = 0x851B; + public const uint GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + public const uint GL_COMPRESSED_RGB = 0x84ED; + public const uint GL_COMPRESSED_RGBA = 0x84EE; + public const uint GL_TEXTURE_COMPRESSION_HINT = 0x84EF; + public const uint GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0; + public const uint GL_TEXTURE_COMPRESSED = 0x86A1; + public const uint GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; + public const uint GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; + public const uint GL_CLAMP_TO_BORDER = 0x812D; + + #endregion + + #region OpenGL 1.4 + + // Methods + public void BlendFuncSeparate(uint sfactorRGB, uint dfactorRGB, uint sfactorAlpha, uint dfactorAlpha) + { + GetDelegateFor()(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + } + public void MultiDrawArrays(uint mode, int[] first, int[] count, int primcount) + { + GetDelegateFor()(mode, first, count, primcount); + } + public void MultiDrawElements(uint mode, int[] count, uint type, IntPtr indices, int primcount) + { + GetDelegateFor()(mode, count, type, indices, primcount); + } + public void PointParameter(uint pname, float parameter) + { + GetDelegateFor()(pname, parameter); + } + public void PointParameter(uint pname, float[] parameters) + { + GetDelegateFor()(pname, parameters); + } + public void PointParameter(uint pname, int parameter) + { + GetDelegateFor()(pname, parameter); + } + public void PointParameter(uint pname, int[] parameters) + { + GetDelegateFor()(pname, parameters); + } + + // Deprecated Methods + [Obsolete] + public void FogCoord(float coord) + { + GetDelegateFor()(coord); + } + [Obsolete] + public void FogCoord(float[] coord) + { + GetDelegateFor()(coord); + } + [Obsolete] + public void FogCoord(double coord) + { + GetDelegateFor()(coord); + } + [Obsolete] + public void FogCoord(double[] coord) + { + GetDelegateFor()(coord); + } + [Obsolete] + public void FogCoordPointer(uint type, int stride, IntPtr pointer) + { + GetDelegateFor()(type, stride, pointer); + } + [Obsolete] + public void SecondaryColor3(sbyte red, sbyte green, sbyte blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(sbyte[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(double red, double green, double blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(double[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(float red, float green, float blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(float[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(int red, int green, int blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(int[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(short red, short green, short blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(short[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(byte red, byte green, byte blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(byte[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(uint red, uint green, uint blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(uint[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColor3(ushort red, ushort green, ushort blue) + { + GetDelegateFor()(red, green, blue); + } + [Obsolete] + public void SecondaryColor3(ushort[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void SecondaryColorPointer(int size, uint type, int stride, IntPtr pointer) + { + GetDelegateFor()(size, type, stride, pointer); + } + [Obsolete] + public void WindowPos2(double x, double y) + { + GetDelegateFor()(x, y); + } + [Obsolete] + public void WindowPos2(double[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos2(float x, float y) + { + GetDelegateFor()(x, y); + } + [Obsolete] + public void WindowPos2(float[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos2(int x, int y) + { + GetDelegateFor()(x, y); + } + [Obsolete] + public void WindowPos2(int[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos2(short x, short y) + { + GetDelegateFor()(x, y); + } + [Obsolete] + public void WindowPos2(short[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos3(double x, double y, double z) + { + GetDelegateFor()(x, y, z); + } + [Obsolete] + public void WindowPos3(double[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos3(float x, float y, float z) + { + GetDelegateFor()(x, y, z); + } + [Obsolete] + public void WindowPos3(float[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos3(int x, int y, int z) + { + GetDelegateFor()(x, y, z); + } + [Obsolete] + public void WindowPos3(int[] v) + { + GetDelegateFor()(v); + } + [Obsolete] + public void WindowPos3(short x, short y, short z) + { + GetDelegateFor()(x, y, z); + } + [Obsolete] + public void WindowPos3(short[] v) + { + GetDelegateFor()(v); + } + + // Delegates + private delegate void glBlendFuncSeparate (uint sfactorRGB, uint dfactorRGB, uint sfactorAlpha, uint dfactorAlpha); + private delegate void glMultiDrawArrays (uint mode, int[] first, int[] count, int primcount); + private delegate void glMultiDrawElements (uint mode, int[] count, uint type, IntPtr indices, int primcount); + private delegate void glPointParameterf (uint pname, float parameter); + private delegate void glPointParameterfv (uint pname, float[] parameters); + private delegate void glPointParameteri (uint pname, int parameter); + private delegate void glPointParameteriv (uint pname, int[] parameters); + private delegate void glFogCoordf (float coord); + private delegate void glFogCoordfv (float[] coord); + private delegate void glFogCoordd (double coord); + private delegate void glFogCoorddv (double[] coord); + private delegate void glFogCoordPointer (uint type, int stride, IntPtr pointer); + private delegate void glSecondaryColor3b (sbyte red, sbyte green, sbyte blue); + private delegate void glSecondaryColor3bv (sbyte[] v); + private delegate void glSecondaryColor3d (double red, double green, double blue); + private delegate void glSecondaryColor3dv (double[] v); + private delegate void glSecondaryColor3f (float red, float green, float blue); + private delegate void glSecondaryColor3fv (float[] v); + private delegate void glSecondaryColor3i (int red, int green, int blue); + private delegate void glSecondaryColor3iv (int[] v); + private delegate void glSecondaryColor3s (short red, short green, short blue); + private delegate void glSecondaryColor3sv (short[] v); + private delegate void glSecondaryColor3ub (byte red, byte green, byte blue); + private delegate void glSecondaryColor3ubv (byte[] v); + private delegate void glSecondaryColor3ui (uint red, uint green, uint blue); + private delegate void glSecondaryColor3uiv (uint[] v); + private delegate void glSecondaryColor3us (ushort red, ushort green, ushort blue); + private delegate void glSecondaryColor3usv (ushort[] v); + private delegate void glSecondaryColorPointer (int size, uint type, int stride, IntPtr pointer); + private delegate void glWindowPos2d (double x, double y); + private delegate void glWindowPos2dv (double[] v); + private delegate void glWindowPos2f (float x, float y); + private delegate void glWindowPos2fv (float[] v); + private delegate void glWindowPos2i (int x, int y); + private delegate void glWindowPos2iv (int[] v); + private delegate void glWindowPos2s (short x, short y); + private delegate void glWindowPos2sv (short[] v); + private delegate void glWindowPos3d (double x, double y, double z); + private delegate void glWindowPos3dv (double[] v); + private delegate void glWindowPos3f (float x, float y, float z); + private delegate void glWindowPos3fv (float[] v); + private delegate void glWindowPos3i (int x, int y, int z); + private delegate void glWindowPos3iv (int[] v); + private delegate void glWindowPos3s (short x, short y, short z); + private delegate void glWindowPos3sv (short[] v); + + // Constants + public const uint GL_BLEND_DST_RGB = 0x80C8; + public const uint GL_BLEND_SRC_RGB = 0x80C9; + public const uint GL_BLEND_DST_ALPHA = 0x80CA; + public const uint GL_BLEND_SRC_ALPHA = 0x80CB; + public const uint GL_POINT_FADE_THRESHOLD_SIZE = 0x8128; + public const uint GL_DEPTH_COMPONENT16 = 0x81A5; + public const uint GL_DEPTH_COMPONENT24 = 0x81A6; + public const uint GL_DEPTH_COMPONENT32 = 0x81A7; + public const uint GL_MIRRORED_REPEAT = 0x8370; + public const uint GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; + public const uint GL_TEXTURE_LOD_BIAS = 0x8501; + public const uint GL_INCR_WRAP = 0x8507; + public const uint GL_DECR_WRAP = 0x8508; + public const uint GL_TEXTURE_DEPTH_SIZE = 0x884A; + public const uint GL_TEXTURE_COMPARE_MODE = 0x884C; + public const uint GL_TEXTURE_COMPARE_FUNC = 0x884D; + + #endregion + + #region OpenGL 1.5 + + // Methods + public void GenQueries(int n, uint[] ids) + { + GetDelegateFor()(n, ids); + } + public void DeleteQueries(int n, uint[] ids) + { + GetDelegateFor()(n, ids); + } + public bool IsQuery(uint id) + { + return (bool)GetDelegateFor()(id); + } + public void BeginQuery(uint target, uint id) + { + GetDelegateFor()(target, id); + } + public void EndQuery(uint target) + { + GetDelegateFor()(target); + } + public void GetQuery(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetQueryObject(uint id, uint pname, int[] parameters) + { + GetDelegateFor()(id, pname, parameters); + } + public void GetQueryObject(uint id, uint pname, uint[] parameters) + { + GetDelegateFor()(id, pname, parameters); + } + public void BindBuffer(uint target, uint buffer) + { + GetDelegateFor()(target, buffer); + } + public void DeleteBuffers(int n, uint[] buffers) + { + GetDelegateFor()(n, buffers); + } + public void GenBuffers(int n, uint[] buffers) + { + GetDelegateFor()(n, buffers); + } + public bool IsBuffer(uint buffer) + { + return (bool)GetDelegateFor()(buffer); + } + public void BufferData(uint target, int size, IntPtr data, uint usage) + { + GetDelegateFor()(target, size, data, usage); + } + public void BufferData(uint target, float[] data, uint usage) + { + IntPtr p = Marshal.AllocHGlobal(data.Length * sizeof(float)); + Marshal.Copy(data, 0, p, data.Length); + GetDelegateFor()(target, data.Length * sizeof(float), p, usage); + Marshal.FreeHGlobal(p); + } + public void BufferData(uint target, ushort[] data, uint usage) + { + var dataSize = data.Length * sizeof(ushort); + IntPtr p = Marshal.AllocHGlobal(dataSize); + var shortData = new short[data.Length]; + Buffer.BlockCopy(data, 0, shortData, 0, dataSize); + Marshal.Copy(shortData, 0, p, data.Length); + GetDelegateFor()(target, dataSize, p, usage); + Marshal.FreeHGlobal(p); + } + public void BufferSubData(uint target, int offset, int size, IntPtr data) + { + GetDelegateFor()(target, offset, size, data); + } + public void GetBufferSubData(uint target, int offset, int size, IntPtr data) + { + GetDelegateFor()(target, offset, size, data); + } + public IntPtr MapBuffer(uint target, uint access) + { + return (IntPtr)GetDelegateFor()(target, access); + } + public bool UnmapBuffer(uint target) + { + return (bool)GetDelegateFor()(target); + } + public void GetBufferParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetBufferPointer(uint target, uint pname, IntPtr[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + // Delegates + private delegate void glGenQueries (int n, uint[] ids); + private delegate void glDeleteQueries (int n, uint[] ids); + private delegate bool glIsQuery (uint id); + private delegate void glBeginQuery (uint target, uint id); + private delegate void glEndQuery (uint target); + private delegate void glGetQueryiv (uint target, uint pname, int[] parameters); + private delegate void glGetQueryObjectiv (uint id, uint pname, int[] parameters); + private delegate void glGetQueryObjectuiv (uint id, uint pname, uint[] parameters); + private delegate void glBindBuffer (uint target, uint buffer); + private delegate void glDeleteBuffers (int n, uint[] buffers); + private delegate void glGenBuffers (int n, uint[] buffers); + private delegate bool glIsBuffer (uint buffer); + private delegate void glBufferData(uint target, int size, IntPtr data, uint usage); + private delegate void glBufferSubData (uint target, int offset, int size, IntPtr data); + private delegate void glGetBufferSubData (uint target, int offset, int size, IntPtr data); + private delegate IntPtr glMapBuffer (uint target, uint access); + private delegate bool glUnmapBuffer (uint target); + private delegate void glGetBufferParameteriv (uint target, uint pname, int[] parameters); + private delegate void glGetBufferPointerv (uint target, uint pname, IntPtr[] parameters); + + // Constants + public const uint GL_BUFFER_SIZE = 0x8764; + public const uint GL_BUFFER_USAGE = 0x8765; + public const uint GL_QUERY_COUNTER_BITS = 0x8864; + public const uint GL_CURRENT_QUERY = 0x8865; + public const uint GL_QUERY_RESULT = 0x8866; + public const uint GL_QUERY_RESULT_AVAILABLE = 0x8867; + public const uint GL_ARRAY_BUFFER = 0x8892; + public const uint GL_ELEMENT_ARRAY_BUFFER = 0x8893; + public const uint GL_ARRAY_BUFFER_BINDING = 0x8894; + public const uint GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + public const uint GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + public const uint GL_READ_ONLY = 0x88B8; + public const uint GL_WRITE_ONLY = 0x88B9; + public const uint GL_READ_WRITE = 0x88BA; + public const uint GL_BUFFER_ACCESS = 0x88BB; + public const uint GL_BUFFER_MAPPED = 0x88BC; + public const uint GL_BUFFER_MAP_POINTER = 0x88BD; + public const uint GL_STREAM_DRAW = 0x88E0; + public const uint GL_STREAM_READ = 0x88E1; + public const uint GL_STREAM_COPY = 0x88E2; + public const uint GL_STATIC_DRAW = 0x88E4; + public const uint GL_STATIC_READ = 0x88E5; + public const uint GL_STATIC_COPY = 0x88E6; + public const uint GL_DYNAMIC_DRAW = 0x88E8; + public const uint GL_DYNAMIC_READ = 0x88E9; + public const uint GL_DYNAMIC_COPY = 0x88EA; + public const uint GL_SAMPLES_PASSED = 0x8914; + + #endregion + + #region OpenGL 2.0 + + // Methods + public void BlendEquationSeparate (uint modeRGB, uint modeAlpha) + { + GetDelegateFor()(modeRGB, modeAlpha); + } + public void DrawBuffers (int n, uint[] bufs) + { + GetDelegateFor()(n, bufs); + } + public void StencilOpSeparate (uint face, uint sfail, uint dpfail, uint dppass) + { + GetDelegateFor()(face, sfail, dpfail, dppass); + } + public void StencilFuncSeparate (uint face, uint func, int reference, uint mask) + { + GetDelegateFor()(face, func, reference, mask); + } + public void StencilMaskSeparate (uint face, uint mask) + { + GetDelegateFor()(face, mask); + } + public void AttachShader (uint program, uint shader) + { + GetDelegateFor()(program, shader); + } + public void BindAttribLocation (uint program, uint index, string name) + { + GetDelegateFor()(program, index, name); + } + /// + /// Compile a shader object + /// + /// Specifies the shader object to be compiled. + public void CompileShader (uint shader) + { + GetDelegateFor()(shader); + } + public uint CreateProgram () + { + return (uint)GetDelegateFor()(); + } + /// + /// Create a shader object + /// + /// Specifies the type of shader to be created. Must be either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. + /// This function returns 0 if an error occurs creating the shader object. Otherwise the shader id is returned. + public uint CreateShader (uint type) + { + return (uint)GetDelegateFor()(type); + } + public void DeleteProgram (uint program) + { + GetDelegateFor()(program); + } + public void DeleteShader (uint shader) + { + GetDelegateFor()(shader); + } + public void DetachShader (uint program, uint shader) + { + GetDelegateFor()(program, shader); + } + public void DisableVertexAttribArray (uint index) + { + GetDelegateFor()(index); + } + public void EnableVertexAttribArray (uint index) + { + GetDelegateFor()(index); + } + + + /// + /// Return information about an active attribute variable + /// + /// Specifies the program object to be queried. + /// Specifies the index of the attribute variable to be queried. + /// Specifies the maximum number of characters OpenGL is allowed to write in the character buffer indicated by . + /// Returns the number of characters actually written by OpenGL in the string indicated by name (excluding the null terminator) if a value other than NULL is passed. + /// Returns the size of the attribute variable. + /// Returns the data type of the attribute variable. + /// Returns a null terminated string containing the name of the attribute variable. + public void GetActiveAttrib (uint program, uint index, int bufSize, out int length, out int size, out uint type, out string name) + { + var builder = new StringBuilder(bufSize); + GetDelegateFor()(program, index, bufSize, out length, out size, out type, builder); + name = builder.ToString(); + } + + /// + /// Return information about an active uniform variable + /// + /// Specifies the program object to be queried. + /// Specifies the index of the uniform variable to be queried. + /// Specifies the maximum number of characters OpenGL is allowed + /// to write in the character buffer indicated by . + /// Returns the number of characters actually written by OpenGL in the string indicated by name + /// (excluding the null terminator) if a value other than NULL is passed. + /// Returns the size of the uniform variable. + /// Returns the data type of the uniform variable. + /// Returns a null terminated string containing the name of the uniform variable. + public void GetActiveUniform (uint program, uint index, int bufSize, out int length, out int size, out uint type, out string name) + { + var builder = new StringBuilder(bufSize); + GetDelegateFor()(program, index, bufSize, out length, out size, out type, builder); + name = builder.ToString(); + } + + public void GetAttachedShaders (uint program, int maxCount, int[] count, uint[] obj) + { + GetDelegateFor()(program, maxCount, count, obj); + } + public int GetAttribLocation (uint program, string name) + { + return (int)GetDelegateFor()(program, name); + } + public void GetProgram (uint program, uint pname, int[] parameters) + { + GetDelegateFor()(program, pname, parameters); + } + public void GetProgramInfoLog(uint program, int bufSize, IntPtr length, StringBuilder infoLog) + { + GetDelegateFor()(program, bufSize, length, infoLog); + } + public void GetShader (uint shader, uint pname, int[] parameters) + { + GetDelegateFor()(shader, pname, parameters); + } + public void GetShaderInfoLog (uint shader, int bufSize, IntPtr length, StringBuilder infoLog) + { + GetDelegateFor()(shader, bufSize, length, infoLog); + + } + public void GetShaderSource(uint shader, int bufSize, IntPtr length, StringBuilder source) + { + GetDelegateFor()(shader, bufSize, length, source); + } + /// + /// Returns an integer that represents the location of a specific uniform variable within a program object. name must be a null terminated string that contains no white space. name must be an active uniform variable name in program that is not a structure, an array of structures, or a subcomponent of a vector or a matrix. This function returns -1 if name does not correspond to an active uniform variable in program, if name starts with the reserved prefix "gl_", or if name is associated with an atomic counter or a named uniform block. + /// + /// Specifies the program object to be queried. + /// Points to a null terminated string containing the name of the uniform variable whose location is to be queried. + /// + public int GetUniformLocation (uint program, string name) + { + return (int)GetDelegateFor()(program, name); + } + public void GetUniform (uint program, int location, float[] parameters) + { + GetDelegateFor()(program, location, parameters); + } + public void GetUniform (uint program, int location, int[] parameters) + { + GetDelegateFor()(program, location, parameters); + } + public void GetVertexAttrib (uint index, uint pname, double[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttrib (uint index, uint pname, float[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttrib (uint index, uint pname, int[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttribPointer(uint index, uint pname, IntPtr pointer) + { + GetDelegateFor()(index, pname, pointer); + } + public bool IsProgram (uint program) + { + return (bool)GetDelegateFor()(program); + } + public bool IsShader (uint shader) + { + return (bool)GetDelegateFor()(shader); + } + public void LinkProgram (uint program) + { + GetDelegateFor()(program); + } + + /// + /// Replace the source code in a shader object + /// + /// Specifies the handle of the shader object whose source code is to be replaced. + /// The source. + public void ShaderSource (uint shader, string source) + { + // Remember, the function takes an array of strings but concatenates them, so we should NOT split into lines! + GetDelegateFor()(shader, 1, new[] { source }, new[] { source.Length }); + } + + public static IntPtr StringToPtrAnsi(string str) + { + if (string.IsNullOrEmpty(str)) + return IntPtr.Zero; + + byte[] bytes = Encoding.ASCII.GetBytes(str + '\0'); + IntPtr strPtr = Marshal.AllocHGlobal(bytes.Length); + Marshal.Copy(bytes, 0, strPtr, bytes.Length); + + return strPtr; + } + public void UseProgram (uint program) + { + GetDelegateFor()(program); + } + public void Uniform1 (int location, float v0) + { + GetDelegateFor()(location, v0); + } + public void Uniform2 (int location, float v0, float v1) + { + GetDelegateFor()(location, v0, v1); + } + public void Uniform3 (int location, float v0, float v1, float v2) + { + GetDelegateFor()(location, v0, v1, v2); + } + public void Uniform4 (int location, float v0, float v1, float v2, float v3) + { + GetDelegateFor()(location, v0, v1, v2, v3); + } + public void Uniform1 (int location, int v0) + { + GetDelegateFor()(location, v0); + } + public void Uniform2 (int location, int v0, int v1) + { + GetDelegateFor()(location, v0, v1); + } + public void Uniform3(int location, int v0, int v1, int v2) + { + GetDelegateFor()(location, v0, v1, v2); + } + public void Uniform (int location, int v0, int v1, int v2, int v3) + { + GetDelegateFor()(location, v0, v1, v2, v3); + } + public void Uniform1 (int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform2 (int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform3 (int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform4 (int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform1 (int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform2 (int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform3 (int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform4 (int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void UniformMatrix2 (int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix3 (int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix4 (int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void ValidateProgram (uint program) + { + GetDelegateFor()(program); + } + public void VertexAttrib1 (uint index, double x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1 (uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib (uint index, float x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1 (uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib (uint index, short x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1 (uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2 (uint index, double x, double y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2 (uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2 (uint index, float x, float y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2 (uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2 (uint index, short x, short y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2 (uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3 (uint index, double x, double y, double z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3 (uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3 (uint index, float x, float y, float z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3 (uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3 (uint index, short x, short y, short z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3 (uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, sbyte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, byte x, byte y, byte z, byte w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4N (uint index, byte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4N (uint index, ushort[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, sbyte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, double x, double y, double z, double w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4 (uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, float x, float y, float z, float w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4 (uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, short x, short y, short z, short w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4 (uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, byte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4 (uint index, ushort[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribPointer (uint index, int size, uint type, bool normalized, int stride, IntPtr pointer) + { + GetDelegateFor()(index, size, type, normalized, stride, pointer); + } + + // Delegates + private delegate void glBlendEquationSeparate (uint modeRGB, uint modeAlpha); + private delegate void glDrawBuffers (int n, uint[] bufs); + private delegate void glStencilOpSeparate (uint face, uint sfail, uint dpfail, uint dppass); + private delegate void glStencilFuncSeparate (uint face, uint func, int reference, uint mask); + private delegate void glStencilMaskSeparate (uint face, uint mask); + private delegate void glAttachShader (uint program, uint shader); + private delegate void glBindAttribLocation (uint program, uint index, string name); + private delegate void glCompileShader (uint shader); + private delegate uint glCreateProgram (); + private delegate uint glCreateShader (uint type); + private delegate void glDeleteProgram (uint program); + private delegate void glDeleteShader (uint shader); + private delegate void glDetachShader (uint program, uint shader); + private delegate void glDisableVertexAttribArray (uint index); + private delegate void glEnableVertexAttribArray (uint index); + private delegate void glGetActiveAttrib (uint program, uint index, int bufSize, out int length, out int size, out uint type, StringBuilder name); + private delegate void glGetActiveUniform (uint program, uint index, int bufSize, out int length, out int size, out uint type, StringBuilder name); + private delegate void glGetAttachedShaders (uint program, int maxCount, int[] count, uint[] obj); + private delegate int glGetAttribLocation (uint program, string name); + private delegate void glGetProgramiv (uint program, uint pname, int[] parameters); + private delegate void glGetProgramInfoLog(uint program, int bufSize, IntPtr length, StringBuilder infoLog); + private delegate void glGetShaderiv (uint shader, uint pname, int[] parameters); + private delegate void glGetShaderInfoLog (uint shader, int bufSize, IntPtr length, StringBuilder infoLog); + private delegate void glGetShaderSource (uint shader, int bufSize, IntPtr length, StringBuilder source); + private delegate int glGetUniformLocation (uint program, string name); + private delegate void glGetUniformfv (uint program, int location, float[] parameters); + private delegate void glGetUniformiv (uint program, int location, int[] parameters); + private delegate void glGetVertexAttribdv (uint index, uint pname, double[] parameters); + private delegate void glGetVertexAttribfv (uint index, uint pname, float[] parameters); + private delegate void glGetVertexAttribiv (uint index, uint pname, int[] parameters); + private delegate void glGetVertexAttribPointerv (uint index, uint pname, IntPtr pointer); + private delegate bool glIsProgram (uint program); + private delegate bool glIsShader (uint shader); + private delegate void glLinkProgram (uint program); + // By specifying 'ThrowOnUnmappableChar' we protect ourselves from inadvertantly using a unicode character + // in the source which the marshaller cannot map. Without this, it maps it to '?' leading to long and pointless + // sessions of trying to find bugs in the shader, which are most often just copied and pasted unicode characters! + // If you're getting exceptions here, remove all unicode crap from your input files (remember, some unicode + // characters you can't even see). + [UnmanagedFunctionPointer(CallingConvention.StdCall, ThrowOnUnmappableChar = true)] + private delegate void glShaderSource (uint shader, int count, string[] source, int[] length); + private delegate void glUseProgram (uint program); + private delegate void glUniform1f (int location, float v0); + private delegate void glUniform2f (int location, float v0, float v1); + private delegate void glUniform3f (int location, float v0, float v1, float v2); + private delegate void glUniform4f (int location, float v0, float v1, float v2, float v3); + private delegate void glUniform1i (int location, int v0); + private delegate void glUniform2i (int location, int v0, int v1); + private delegate void glUniform3i (int location, int v0, int v1, int v2); + private delegate void glUniform4i (int location, int v0, int v1, int v2, int v3); + private delegate void glUniform1fv (int location, int count, float[] value); + private delegate void glUniform2fv (int location, int count, float[] value); + private delegate void glUniform3fv (int location, int count, float[] value); + private delegate void glUniform4fv (int location, int count, float[] value); + private delegate void glUniform1iv (int location, int count, int[] value); + private delegate void glUniform2iv (int location, int count, int[] value); + private delegate void glUniform3iv (int location, int count, int[] value); + private delegate void glUniform4iv (int location, int count, int[] value); + private delegate void glUniformMatrix2fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix3fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix4fv (int location, int count, bool transpose, float[] value); + private delegate void glValidateProgram (uint program); + private delegate void glVertexAttrib1d (uint index, double x); + private delegate void glVertexAttrib1dv (uint index, double[] v); + private delegate void glVertexAttrib1f (uint index, float x); + private delegate void glVertexAttrib1fv (uint index, float[] v); + private delegate void glVertexAttrib1s (uint index, short x); + private delegate void glVertexAttrib1sv (uint index, short[] v); + private delegate void glVertexAttrib2d (uint index, double x, double y); + private delegate void glVertexAttrib2dv (uint index, double[] v); + private delegate void glVertexAttrib2f (uint index, float x, float y); + private delegate void glVertexAttrib2fv (uint index, float[] v); + private delegate void glVertexAttrib2s (uint index, short x, short y); + private delegate void glVertexAttrib2sv (uint index, short[] v); + private delegate void glVertexAttrib3d (uint index, double x, double y, double z); + private delegate void glVertexAttrib3dv (uint index, double[] v); + private delegate void glVertexAttrib3f (uint index, float x, float y, float z); + private delegate void glVertexAttrib3fv (uint index, float[] v); + private delegate void glVertexAttrib3s (uint index, short x, short y, short z); + private delegate void glVertexAttrib3sv (uint index, short[] v); + private delegate void glVertexAttrib4Nbv (uint index, sbyte[] v); + private delegate void glVertexAttrib4Niv (uint index, int[] v); + private delegate void glVertexAttrib4Nsv (uint index, short[] v); + private delegate void glVertexAttrib4Nub (uint index, byte x, byte y, byte z, byte w); + private delegate void glVertexAttrib4Nubv (uint index, byte[] v); + private delegate void glVertexAttrib4Nuiv (uint index, uint[] v); + private delegate void glVertexAttrib4Nusv (uint index, ushort[] v); + private delegate void glVertexAttrib4bv (uint index, sbyte[] v); + private delegate void glVertexAttrib4d (uint index, double x, double y, double z, double w); + private delegate void glVertexAttrib4dv (uint index, double[] v); + private delegate void glVertexAttrib4f (uint index, float x, float y, float z, float w); + private delegate void glVertexAttrib4fv (uint index, float[] v); + private delegate void glVertexAttrib4iv (uint index, int[] v); + private delegate void glVertexAttrib4s (uint index, short x, short y, short z, short w); + private delegate void glVertexAttrib4sv (uint index, short[] v); + private delegate void glVertexAttrib4ubv (uint index, byte[] v); + private delegate void glVertexAttrib4uiv (uint index, uint[] v); + private delegate void glVertexAttrib4usv (uint index, ushort[] v); + private delegate void glVertexAttribPointer (uint index, int size, uint type, bool normalized, int stride, IntPtr pointer); + + // Constants + public const uint GL_BLEND_EQUATION_RGB = 0x8009; + public const uint GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + public const uint GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + public const uint GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + public const uint GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + public const uint GL_CURRENT_VERTEX_ATTRIB = 0x8626; + public const uint GL_VERTEX_PROGRAM_POINT_SIZE = 0x8642; + public const uint GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + public const uint GL_STENCIL_BACK_FUNC = 0x8800; + public const uint GL_STENCIL_BACK_FAIL = 0x8801; + public const uint GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + public const uint GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + public const uint GL_MAX_DRAW_BUFFERS = 0x8824; + public const uint GL_DRAW_BUFFER0 = 0x8825; + public const uint GL_DRAW_BUFFER1 = 0x8826; + public const uint GL_DRAW_BUFFER2 = 0x8827; + public const uint GL_DRAW_BUFFER3 = 0x8828; + public const uint GL_DRAW_BUFFER4 = 0x8829; + public const uint GL_DRAW_BUFFER5 = 0x882A; + public const uint GL_DRAW_BUFFER6 = 0x882B; + public const uint GL_DRAW_BUFFER7 = 0x882C; + public const uint GL_DRAW_BUFFER8 = 0x882D; + public const uint GL_DRAW_BUFFER9 = 0x882E; + public const uint GL_DRAW_BUFFER10 = 0x882F; + public const uint GL_DRAW_BUFFER11 = 0x8830; + public const uint GL_DRAW_BUFFER12 = 0x8831; + public const uint GL_DRAW_BUFFER13 = 0x8832; + public const uint GL_DRAW_BUFFER14 = 0x8833; + public const uint GL_DRAW_BUFFER15 = 0x8834; + public const uint GL_BLEND_EQUATION_ALPHA = 0x883D; + public const uint GL_MAX_VERTEX_ATTRIBS = 0x8869; + public const uint GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + public const uint GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872; + public const uint GL_FRAGMENT_SHADER = 0x8B30; + public const uint GL_VERTEX_SHADER = 0x8B31; + public const uint GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + public const uint GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + public const uint GL_MAX_VARYING_FLOATS = 0x8B4B; + public const uint GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + public const uint GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + public const uint GL_SHADER_TYPE = 0x8B4F; + public const uint GL_FLOAT_VEC2 = 0x8B50; + public const uint GL_FLOAT_VEC3 = 0x8B51; + public const uint GL_FLOAT_VEC4 = 0x8B52; + public const uint GL_INT_VEC2 = 0x8B53; + public const uint GL_INT_VEC3 = 0x8B54; + public const uint GL_INT_VEC4 = 0x8B55; + public const uint GL_BOOL = 0x8B56; + public const uint GL_BOOL_VEC2 = 0x8B57; + public const uint GL_BOOL_VEC3 = 0x8B58; + public const uint GL_BOOL_VEC4 = 0x8B59; + public const uint GL_FLOAT_MAT2 = 0x8B5A; + public const uint GL_FLOAT_MAT3 = 0x8B5B; + public const uint GL_FLOAT_MAT4 = 0x8B5C; + public const uint GL_SAMPLER_1D = 0x8B5D; + public const uint GL_SAMPLER_2D = 0x8B5E; + public const uint GL_SAMPLER_3D = 0x8B5F; + public const uint GL_SAMPLER_CUBE = 0x8B60; + public const uint GL_SAMPLER_1D_SHADOW = 0x8B61; + public const uint GL_SAMPLER_2D_SHADOW = 0x8B62; + public const uint GL_DELETE_STATUS = 0x8B80; + public const uint GL_COMPILE_STATUS = 0x8B81; + public const uint GL_LINK_STATUS = 0x8B82; + public const uint GL_VALIDATE_STATUS = 0x8B83; + public const uint GL_INFO_LOG_LENGTH = 0x8B84; + public const uint GL_ATTACHED_SHADERS = 0x8B85; + public const uint GL_ACTIVE_UNIFORMS = 0x8B86; + public const uint GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; + public const uint GL_SHADER_SOURCE_LENGTH = 0x8B88; + public const uint GL_ACTIVE_ATTRIBUTES = 0x8B89; + public const uint GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; + public const uint GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + public const uint GL_SHADING_LANGUAGE_VERSION = 0x8B8C; + public const uint GL_CURRENT_PROGRAM = 0x8B8D; + public const uint GL_POINT_SPRITE_COORD_ORIGIN = 0x8CA0; + public const uint GL_LOWER_LEFT = 0x8CA1; + public const uint GL_UPPER_LEFT = 0x8CA2; + public const uint GL_STENCIL_BACK_REF = 0x8CA3; + public const uint GL_STENCIL_BACK_VALUE_MASK = 0x8CA4; + public const uint GL_STENCIL_BACK_WRITEMASK = 0x8CA5; + + #endregion + + #region OpenGL 2.1 + + // Methods + public void UniformMatrix2x3(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix3x2(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix2x4(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix4x2(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix3x4(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix4x3(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + + // Delegates + private delegate void glUniformMatrix2x3fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix3x2fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix2x4fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix4x2fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix3x4fv (int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix4x3fv (int location, int count, bool transpose, float[] value); + + // Constants + public const uint GL_PIXEL_PACK_BUFFER = 0x88EB; + public const uint GL_PIXEL_UNPACK_BUFFER = 0x88EC; + public const uint GL_PIXEL_PACK_BUFFER_BINDING = 0x88ED; + public const uint GL_PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; + public const uint GL_FLOAT_MAT2x3 = 0x8B65; + public const uint GL_FLOAT_MAT2x4 = 0x8B66; + public const uint GL_FLOAT_MAT3x2 = 0x8B67; + public const uint GL_FLOAT_MAT3x4 = 0x8B68; + public const uint GL_FLOAT_MAT4x2 = 0x8B69; + public const uint GL_FLOAT_MAT4x3 = 0x8B6A; + public const uint GL_SRGB = 0x8C40; + public const uint GL_SRGB8 = 0x8C41; + public const uint GL_SRGB_ALPHA = 0x8C42; + public const uint GL_SRGB8_ALPHA8 = 0x8C43; + public const uint GL_COMPRESSED_SRGB = 0x8C48; + public const uint GL_COMPRESSED_SRGB_ALPHA = 0x8C49; + + #endregion + + #region OpenGL 3.0 + + // Methods + public void ColorMask(uint index, bool r, bool g, bool b, bool a) + { + GetDelegateFor()(index, r, g, b, a); + } + public void GetBoolean(uint target, uint index, bool[] data) + { + GetDelegateFor()(target, index, data); + } + public void GetInteger(uint target, uint index, int[] data) + { + GetDelegateFor()(target, index, data); + } + public void Enable(uint target, uint index) + { + GetDelegateFor()(target, index); + } + public void Disable(uint target, uint index) + { + GetDelegateFor()(target, index); + } + public bool IsEnabled(uint target, uint index) + { + return (bool)GetDelegateFor()(target, index); + } + public void BeginTransformFeedback(uint primitiveMode) + { + GetDelegateFor()(primitiveMode); + } + public void EndTransformFeedback() + { + GetDelegateFor()(); + } + public void BindBufferRange(uint target, uint index, uint buffer, int offset, int size) + { + GetDelegateFor()(target, index, buffer, offset, size); + } + public void BindBufferBase(uint target, uint index, uint buffer) + { + GetDelegateFor()(target, index, buffer); + } + public void TransformFeedbackVaryings(uint program, int count, string[] varyings, uint bufferMode) + { + GetDelegateFor()(program, count, varyings, bufferMode); + } + public void GetTransformFeedbackVarying(uint program, uint index, int bufSize, int[] length, int[] size, uint[] type, string name) + { + GetDelegateFor()(program, index, bufSize, length, size, type, name); + } + public void ClampColor(uint target, uint clamp) + { + GetDelegateFor()(target, clamp); + } + public void BeginConditionalRender(uint id, uint mode) + { + GetDelegateFor()(id, mode); + } + public void EndConditionalRender() + { + GetDelegateFor()(); + } + public void VertexAttribIPointer(uint index, int size, uint type, int stride, IntPtr pointer) + { + GetDelegateFor()(index, size, type, stride, pointer); + } + public void GetVertexAttribI(uint index, uint pname, int[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttribI(uint index, uint pname, uint[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void VertexAttribI1(uint index, int x) + { + GetDelegateFor()(index, x); + } + public void VertexAttribI2(uint index, int x, int y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttribI3(uint index, int x, int y, int z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttribI4(uint index, int x, int y, int z, int w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttribI1(uint index, uint x) + { + GetDelegateFor()(index, x); + } + public void VertexAttribI2(uint index, uint x, uint y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttribI3(uint index, uint x, uint y, uint z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttribI4(uint index, uint x, uint y, uint z, uint w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttribI1(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI2(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI3(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI1(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI2(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI3(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, sbyte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, byte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribI4(uint index, ushort[] v) + { + GetDelegateFor()(index, v); + } + public void GetUniform(uint program, int location, uint[] parameters) + { + GetDelegateFor()(program, location, parameters); + } + public void BindFragDataLocation(uint program, uint color, string name) + { + GetDelegateFor()(program, color, name); + } + public int GetFragDataLocation(uint program, string name) + { + return (int)GetDelegateFor()(program, name); + } + public void Uniform1(int location, uint v0) + { + GetDelegateFor()(location, v0); + } + public void Uniform2(int location, uint v0, uint v1) + { + GetDelegateFor()(location, v0, v1); + } + public void Uniform3(int location, uint v0, uint v1, uint v2) + { + GetDelegateFor()(location, v0, v1, v2); + } + public void Uniform4(int location, uint v0, uint v1, uint v2, uint v3) + { + GetDelegateFor()(location, v0, v1, v2, v3); + } + public void Uniform1(int location, int count, uint[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform2(int location, int count, uint[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform3(int location, int count, uint[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform4(int location, int count, uint[] value) + { + GetDelegateFor()(location, count, value); + } + public void TexParameterI(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void TexParameterI(uint target, uint pname, uint[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetTexParameterI(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetTexParameterI(uint target, uint pname, uint[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void ClearBuffer(uint buffer, int drawbuffer, int[] value) + { + GetDelegateFor()(buffer, drawbuffer, value); + } + public void ClearBuffer(uint buffer, int drawbuffer, uint[] value) + { + GetDelegateFor()(buffer, drawbuffer, value); + } + public void ClearBuffer(uint buffer, int drawbuffer, float[] value) + { + GetDelegateFor()(buffer, drawbuffer, value); + } + public void ClearBuffer(uint buffer, int drawbuffer, float depth, int stencil) + { + GetDelegateFor()(buffer, drawbuffer, depth, stencil); + } + public string GetString(uint name, uint index) + { + return (string)GetDelegateFor()(name, index); + } + + // Delegates + private delegate void glColorMaski (uint index, bool r, bool g, bool b, bool a); + private delegate void glGetBooleani_v (uint target, uint index, bool[] data); + private delegate void glGetIntegeri_v (uint target, uint index, int[] data); + private delegate void glEnablei (uint target, uint index); + private delegate void glDisablei (uint target, uint index); + private delegate bool glIsEnabledi (uint target, uint index); + private delegate void glBeginTransformFeedback (uint primitiveMode); + private delegate void glEndTransformFeedback (); + private delegate void glBindBufferRange (uint target, uint index, uint buffer, int offset, int size); + private delegate void glBindBufferBase (uint target, uint index, uint buffer); + private delegate void glTransformFeedbackVaryings (uint program, int count, string[] varyings, uint bufferMode); + private delegate void glGetTransformFeedbackVarying (uint program, uint index, int bufSize, int[] length, int[] size, uint[] type, string name); + private delegate void glClampColor (uint target, uint clamp); + private delegate void glBeginConditionalRender (uint id, uint mode); + private delegate void glEndConditionalRender (); + private delegate void glVertexAttribIPointer (uint index, int size, uint type, int stride, IntPtr pointer); + private delegate void glGetVertexAttribIiv (uint index, uint pname, int[] parameters); + private delegate void glGetVertexAttribIuiv (uint index, uint pname, uint[] parameters); + private delegate void glVertexAttribI1i (uint index, int x); + private delegate void glVertexAttribI2i (uint index, int x, int y); + private delegate void glVertexAttribI3i (uint index, int x, int y, int z); + private delegate void glVertexAttribI4i (uint index, int x, int y, int z, int w); + private delegate void glVertexAttribI1ui (uint index, uint x); + private delegate void glVertexAttribI2ui (uint index, uint x, uint y); + private delegate void glVertexAttribI3ui (uint index, uint x, uint y, uint z); + private delegate void glVertexAttribI4ui (uint index, uint x, uint y, uint z, uint w); + private delegate void glVertexAttribI1iv (uint index, int[] v); + private delegate void glVertexAttribI2iv (uint index, int[] v); + private delegate void glVertexAttribI3iv (uint index, int[] v); + private delegate void glVertexAttribI4iv (uint index, int[] v); + private delegate void glVertexAttribI1uiv (uint index, uint[] v); + private delegate void glVertexAttribI2uiv (uint index, uint[] v); + private delegate void glVertexAttribI3uiv (uint index, uint[] v); + private delegate void glVertexAttribI4uiv (uint index, uint[] v); + private delegate void glVertexAttribI4bv (uint index, sbyte[] v); + private delegate void glVertexAttribI4sv (uint index, short[] v); + private delegate void glVertexAttribI4ubv (uint index, byte[] v); + private delegate void glVertexAttribI4usv (uint index, ushort[] v); + private delegate void glGetUniformuiv (uint program, int location, uint[] parameters); + private delegate void glBindFragDataLocation (uint program, uint color, string name); + private delegate int glGetFragDataLocation (uint program, string name); + private delegate void glUniform1ui (int location, uint v0); + private delegate void glUniform2ui (int location, uint v0, uint v1); + private delegate void glUniform3ui (int location, uint v0, uint v1, uint v2); + private delegate void glUniform4ui (int location, uint v0, uint v1, uint v2, uint v3); + private delegate void glUniform1uiv (int location, int count, uint[] value); + private delegate void glUniform2uiv (int location, int count, uint[] value); + private delegate void glUniform3uiv (int location, int count, uint[] value); + private delegate void glUniform4uiv (int location, int count, uint[] value); + private delegate void glTexParameterIiv (uint target, uint pname, int[] parameters); + private delegate void glTexParameterIuiv (uint target, uint pname, uint[] parameters); + private delegate void glGetTexParameterIiv (uint target, uint pname, int[] parameters); + private delegate void glGetTexParameterIuiv (uint target, uint pname, uint[] parameters); + private delegate void glClearBufferiv (uint buffer, int drawbuffer, int[] value); + private delegate void glClearBufferuiv (uint buffer, int drawbuffer, uint[] value); + private delegate void glClearBufferfv (uint buffer, int drawbuffer, float[] value); + private delegate void glClearBufferfi (uint buffer, int drawbuffer, float depth, int stencil); + private delegate string glGetStringi (uint name, uint index); + + // Constants + public const uint GL_COMPARE_REF_TO_TEXTURE = 0x884E; + public const uint GL_CLIP_DISTANCE0 = 0x3000; + public const uint GL_CLIP_DISTANCE1 = 0x3001; + public const uint GL_CLIP_DISTANCE2 = 0x3002; + public const uint GL_CLIP_DISTANCE3 = 0x3003; + public const uint GL_CLIP_DISTANCE4 = 0x3004; + public const uint GL_CLIP_DISTANCE5 = 0x3005; + public const uint GL_CLIP_DISTANCE6 = 0x3006; + public const uint GL_CLIP_DISTANCE7 = 0x3007; + public const uint GL_MAX_CLIP_DISTANCES = 0x0D32; + public const uint GL_MAJOR_VERSION = 0x821B; + public const uint GL_MINOR_VERSION = 0x821C; + public const uint GL_NUM_EXTENSIONS = 0x821D; + public const uint GL_CONTEXT_FLAGS = 0x821E; + public const uint GL_DEPTH_BUFFER = 0x8223; + public const uint GL_STENCIL_BUFFER = 0x8224; + public const uint GL_COMPRESSED_RED = 0x8225; + public const uint GL_COMPRESSED_RG = 0x8226; + public const uint GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001; + public const uint GL_RGBA32F = 0x8814; + public const uint GL_RGB32F = 0x8815; + public const uint GL_RGBA16F = 0x881A; + public const uint GL_RGB16F = 0x881B; + public const uint GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + public const uint GL_MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + public const uint GL_MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + public const uint GL_MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + public const uint GL_CLAMP_READ_COLOR = 0x891C; + public const uint GL_FIXED_ONLY = 0x891D; + public const uint GL_MAX_VARYING_COMPONENTS = 0x8B4B; + public const uint GL_TEXTURE_1D_ARRAY = 0x8C18; + public const uint GL_PROXY_TEXTURE_1D_ARRAY = 0x8C19; + public const uint GL_TEXTURE_2D_ARRAY = 0x8C1A; + public const uint GL_PROXY_TEXTURE_2D_ARRAY = 0x8C1B; + public const uint GL_TEXTURE_BINDING_1D_ARRAY = 0x8C1C; + public const uint GL_TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + public const uint GL_R11F_G11F_B10F = 0x8C3A; + public const uint GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + public const uint GL_RGB9_E5 = 0x8C3D; + public const uint GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + public const uint GL_TEXTURE_SHARED_SIZE = 0x8C3F; + public const uint GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + public const uint GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + public const uint GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + public const uint GL_PRIMITIVES_GENERATED = 0x8C87; + public const uint GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + public const uint GL_RASTERIZER_DISCARD = 0x8C89; + public const uint GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + public const uint GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + public const uint GL_INTERLEAVED_ATTRIBS = 0x8C8C; + public const uint GL_SEPARATE_ATTRIBS = 0x8C8D; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + public const uint GL_RGBA32UI = 0x8D70; + public const uint GL_RGB32UI = 0x8D71; + public const uint GL_RGBA16UI = 0x8D76; + public const uint GL_RGB16UI = 0x8D77; + public const uint GL_RGBA8UI = 0x8D7C; + public const uint GL_RGB8UI = 0x8D7D; + public const uint GL_RGBA32I = 0x8D82; + public const uint GL_RGB32I = 0x8D83; + public const uint GL_RGBA16I = 0x8D88; + public const uint GL_RGB16I = 0x8D89; + public const uint GL_RGBA8I = 0x8D8E; + public const uint GL_RGB8I = 0x8D8F; + public const uint GL_RED_INTEGER = 0x8D94; + public const uint GL_GREEN_INTEGER = 0x8D95; + public const uint GL_BLUE_INTEGER = 0x8D96; + public const uint GL_RGB_INTEGER = 0x8D98; + public const uint GL_RGBA_INTEGER = 0x8D99; + public const uint GL_BGR_INTEGER = 0x8D9A; + public const uint GL_BGRA_INTEGER = 0x8D9B; + public const uint GL_SAMPLER_1D_ARRAY = 0x8DC0; + public const uint GL_SAMPLER_2D_ARRAY = 0x8DC1; + public const uint GL_SAMPLER_1D_ARRAY_SHADOW = 0x8DC3; + public const uint GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + public const uint GL_SAMPLER_CUBE_SHADOW = 0x8DC5; + public const uint GL_UNSIGNED_INT_VEC2 = 0x8DC6; + public const uint GL_UNSIGNED_INT_VEC3 = 0x8DC7; + public const uint GL_UNSIGNED_INT_VEC4 = 0x8DC8; + public const uint GL_INT_SAMPLER_1D = 0x8DC9; + public const uint GL_INT_SAMPLER_2D = 0x8DCA; + public const uint GL_INT_SAMPLER_3D = 0x8DCB; + public const uint GL_INT_SAMPLER_CUBE = 0x8DCC; + public const uint GL_INT_SAMPLER_1D_ARRAY = 0x8DCE; + public const uint GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; + public const uint GL_UNSIGNED_INT_SAMPLER_1D = 0x8DD1; + public const uint GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + public const uint GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + public const uint GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + public const uint GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6; + public const uint GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + public const uint GL_QUERY_WAIT = 0x8E13; + public const uint GL_QUERY_NO_WAIT = 0x8E14; + public const uint GL_QUERY_BY_REGION_WAIT = 0x8E15; + public const uint GL_QUERY_BY_REGION_NO_WAIT = 0x8E16; + public const uint GL_BUFFER_ACCESS_FLAGS = 0x911F; + public const uint GL_BUFFER_MAP_LENGTH = 0x9120; + public const uint GL_BUFFER_MAP_OFFSET = 0x9121; + public const uint GL_R8 = 0x8229; + public const uint GL_R16 = 0x822A; + public const uint GL_RG8 = 0x822B; + public const uint GL_RG16 = 0x822C; + public const uint GL_R16F = 0x822D; + public const uint GL_R32F = 0x822E; + public const uint GL_RG16F = 0x822F; + public const uint GL_RG32F = 0x8230; + public const uint GL_R8I = 0x8231; + public const uint GL_R8UI = 0x8232; + public const uint GL_R16I = 0x8233; + public const uint GL_R16UI = 0x8234; + public const uint GL_R32I = 0x8235; + public const uint GL_R32UI = 0x8236; + public const uint GL_RG8I = 0x8237; + public const uint GL_RG8UI = 0x8238; + public const uint GL_RG16I = 0x8239; + public const uint GL_RG16UI = 0x823A; + public const uint GL_RG32I = 0x823B; + public const uint GL_RG32UI = 0x823C; + public const uint GL_RG = 0x8227; + public const uint GL_RG_INTEGER = 0x8228; + + #endregion + + #region OpenGL 3.1 + + // Methods + public void DrawArraysInstanced(uint mode, int first, int count, int primcount) + { + GetDelegateFor()(mode, first, count, primcount); + } + public void DrawElementsInstanced(uint mode, int count, uint type, IntPtr indices, int primcount) + { + GetDelegateFor()(mode, count, type, indices, primcount); + } + public void TexBuffer(uint target, uint internalformat, uint buffer) + { + GetDelegateFor()(target, internalformat, buffer); + } + public void PrimitiveRestartIndex(uint index) + { + GetDelegateFor()(index); + } + + // Delegates + private delegate void glDrawArraysInstanced (uint mode, int first, int count, int primcount); + private delegate void glDrawElementsInstanced (uint mode, int count, uint type, IntPtr indices, int primcount); + private delegate void glTexBuffer (uint target, uint internalformat, uint buffer); + private delegate void glPrimitiveRestartIndex (uint index); + + // Constants + public const uint GL_SAMPLER_2D_RECT = 0x8B63; + public const uint GL_SAMPLER_2D_RECT_SHADOW = 0x8B64; + public const uint GL_SAMPLER_BUFFER = 0x8DC2; + public const uint GL_INT_SAMPLER_2D_RECT = 0x8DCD; + public const uint GL_INT_SAMPLER_BUFFER = 0x8DD0; + public const uint GL_UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5; + public const uint GL_UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8; + public const uint GL_TEXTURE_BUFFER = 0x8C2A; + public const uint GL_MAX_TEXTURE_BUFFER_SIZE = 0x8C2B; + public const uint GL_TEXTURE_BINDING_BUFFER = 0x8C2C; + public const uint GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D; + public const uint GL_TEXTURE_BUFFER_FORMAT = 0x8C2E; + public const uint GL_TEXTURE_RECTANGLE = 0x84F5; + public const uint GL_TEXTURE_BINDING_RECTANGLE = 0x84F6; + public const uint GL_PROXY_TEXTURE_RECTANGLE = 0x84F7; + public const uint GL_MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8; + public const uint GL_RED_SNORM = 0x8F90; + public const uint GL_RG_SNORM = 0x8F91; + public const uint GL_RGB_SNORM = 0x8F92; + public const uint GL_RGBA_SNORM = 0x8F93; + public const uint GL_R8_SNORM = 0x8F94; + public const uint GL_RG8_SNORM = 0x8F95; + public const uint GL_RGB8_SNORM = 0x8F96; + public const uint GL_RGBA8_SNORM = 0x8F97; + public const uint GL_R16_SNORM = 0x8F98; + public const uint GL_RG16_SNORM = 0x8F99; + public const uint GL_RGB16_SNORM = 0x8F9A; + public const uint GL_RGBA16_SNORM = 0x8F9B; + public const uint GL_SIGNED_NORMALIZED = 0x8F9C; + public const uint GL_PRIMITIVE_RESTART = 0x8F9D; + public const uint GL_PRIMITIVE_RESTART_INDEX = 0x8F9E; + + #endregion + + #region OpenGL 3.2 + + // Methods + public void GetInteger64(uint target, uint index, Int64[] data) + { + GetDelegateFor()(target, index, data); + } + public void GetBufferParameteri64(uint target, uint pname, Int64[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void FramebufferTexture(uint target, uint attachment, uint texture, int level) + { + GetDelegateFor()(target, attachment, texture, level); + } + + // Delegates + private delegate void glGetInteger64i_v (uint target, uint index, Int64[] data); + private delegate void glGetBufferParameteri64v (uint target, uint pname, Int64[] parameters); + private delegate void glFramebufferTexture (uint target, uint attachment, uint texture, int level); + + // Constants + public const uint GL_CONTEXT_CORE_PROFILE_BIT = 0x00000001; + public const uint GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002; + public const uint GL_LINES_ADJACENCY = 0x000A; + public const uint GL_LINE_STRIP_ADJACENCY = 0x000B; + public const uint GL_TRIANGLES_ADJACENCY = 0x000C; + public const uint GL_TRIANGLE_STRIP_ADJACENCY = 0x000D; + public const uint GL_PROGRAM_POINT_SIZE = 0x8642; + public const uint GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; + public const uint GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7; + public const uint GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8; + public const uint GL_GEOMETRY_SHADER = 0x8DD9; + public const uint GL_GEOMETRY_VERTICES_OUT = 0x8916; + public const uint GL_GEOMETRY_INPUT_TYPE = 0x8917; + public const uint GL_GEOMETRY_OUTPUT_TYPE = 0x8918; + public const uint GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF; + public const uint GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0; + public const uint GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1; + public const uint GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + public const uint GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123; + public const uint GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124; + public const uint GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + public const uint GL_CONTEXT_PROFILE_MASK = 0x9126; + + #endregion + + #region OpenGL 3.3 + + // Methods + public void VertexAttribDivisor(uint index, uint divisor) + { + GetDelegateFor()(index, divisor); + } + + // Delegates + private delegate void glVertexAttribDivisor (uint index, uint divisor); + + // Constants + public const uint GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; + + #endregion + + #region OpenGL 4.0 + + // Methods + public void MinSampleShading(float value) + { + GetDelegateFor()(value); + } + public void BlendEquation(uint buf, uint mode) + { + GetDelegateFor()(buf, mode); + } + public void BlendEquationSeparate(uint buf, uint modeRGB, uint modeAlpha) + { + GetDelegateFor()(buf, modeRGB, modeAlpha); + } + public void BlendFunc(uint buf, uint src, uint dst) + { + GetDelegateFor()(buf, src, dst); + } + public void BlendFuncSeparate(uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha) + { + GetDelegateFor()(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); + } + + // Delegates + private delegate void glMinSampleShading (float value); + private delegate void glBlendEquationi (uint buf, uint mode); + private delegate void glBlendEquationSeparatei (uint buf, uint modeRGB, uint modeAlpha); + private delegate void glBlendFunci (uint buf, uint src, uint dst); + private delegate void glBlendFuncSeparatei (uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha); + + // Constants + public const uint GL_SAMPLE_SHADING = 0x8C36; + public const uint GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37; + public const uint GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5E; + public const uint GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5F; + public const uint GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009; + public const uint GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A; + public const uint GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B; + public const uint GL_SAMPLER_CUBE_MAP_ARRAY = 0x900C; + public const uint GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D; + public const uint GL_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E; + public const uint GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F; + + #endregion + + #region GL_EXT_texture3D + + /// + /// Specify a three-dimensional texture subimage. + /// + /// The target. + /// The level. + /// The internalformat. + /// The width. + /// The height. + /// The depth. + /// The border. + /// The format. + /// The type. + /// The pixels. + public void TexImage3DEXT (uint target, int level, uint internalformat, uint width, + uint height, uint depth, int border, uint format, uint type, IntPtr pixels) + { + GetDelegateFor()(target, level, internalformat, width, height, depth, border, format, type, pixels); + } + + /// + /// Texes the sub image3 DEXT. + /// + /// The target. + /// The level. + /// The xoffset. + /// The yoffset. + /// The zoffset. + /// The width. + /// The height. + /// The depth. + /// The format. + /// The type. + /// The pixels. + public void TexSubImage3DEXT(uint target, int level, int xoffset, int yoffset, int zoffset, + uint width, uint height, uint depth, uint format, uint type, IntPtr pixels) + { + GetDelegateFor()(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + } + + private delegate void glTexImage3DEXT(uint target, int level, uint internalformat, uint width, + uint height, uint depth, int border, uint format, uint type, IntPtr pixels); + private delegate void glTexSubImage3DEXT(uint target, int level, int xoffset, int yoffset, int zoffset, + uint width, uint height, uint depth, uint format, uint type, IntPtr pixels); + + #endregion + + #region GL_EXT_bgra + + public const uint GL_BGR_EXT = 0x80E0; + public const uint GL_BGRA_EXT = 0x80E1; + + #endregion + + #region GL_EXT_packed_pixels + + public const uint GL_UNSIGNED_BYTE_3_3_2_EXT = 0x8032; + public const uint GL_UNSIGNED_SHORT_4_4_4_4_EXT = 0x8033; + public const uint GL_UNSIGNED_SHORT_5_5_5_1_EXT = 0x8034; + public const uint GL_UNSIGNED_INT_8_8_8_8_EXT = 0x8035; + public const uint GL_UNSIGNED_INT_10_10_10_2_EXT = 0x8036; + + #endregion + + #region GL_EXT_rescale_normal + + public const uint GL_RESCALE_NORMAL_EXT = 0x803A; + + #endregion + + #region GL_EXT_separate_specular_color + + public const uint GL_LIGHT_MODEL_COLOR_CONTROL_EXT = 0x81F8; + public const uint GL_SINGLE_COLOR_EXT = 0x81F9; + public const uint GL_SEPARATE_SPECULAR_COLOR_EXT = 0x81FA; + + #endregion + + #region GL_SGIS_texture_edge_clamp + + public const uint GL_CLAMP_TO_EDGE_SGIS = 0x812F; + + #endregion + + #region GL_SGIS_texture_lod + + public const uint GL_TEXTURE_MIN_LOD_SGIS = 0x813A; + public const uint GL_TEXTURE_MAX_LOD_SGIS = 0x813B; + public const uint GL_TEXTURE_BASE_LEVEL_SGIS = 0x813C; + public const uint GL_TEXTURE_MAX_LEVEL_SGIS = 0x813D; + + #endregion + + #region GL_EXT_draw_range_elements + + /// + /// Render primitives from array data. + /// + /// The mode. + /// The start. + /// The end. + /// The count. + /// The type. + /// The indices. + public void DrawRangeElementsEXT(uint mode, uint start, uint end, uint count, uint type, IntPtr indices) + { + GetDelegateFor()(mode, start, end, count, type, indices); + } + + private delegate void glDrawRangeElementsEXT(uint mode, uint start, uint end, uint count, uint type, IntPtr indices); + + public const uint GL_MAX_ELEMENTS_VERTICES_EXT = 0x80E8; + public const uint GL_MAX_ELEMENTS_INDICES_EXT = 0x80E9; + + #endregion + + #region GL_SGI_color_table + + // Delegates + public void ColorTableSGI(uint target, uint internalformat, uint width, uint format, uint type, IntPtr table) + { + GetDelegateFor()(target, internalformat, width, format, type, table); + } + + public void ColorTableParameterSGI(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void ColorTableParameterSGI(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void CopyColorTableSGI(uint target, uint internalformat, int x, int y, uint width) + { + GetDelegateFor()(target, internalformat, x, y, width); + } + + public void GetColorTableSGI(uint target, uint format, uint type, IntPtr table) + { + GetDelegateFor()(target, format, type, table); + } + + public void GetColorTableParameterSGI(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetColorTableParameterSGI(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + // Delegates + private delegate void glColorTableSGI(uint target, uint internalformat, uint width, uint format, uint type, IntPtr table); + private delegate void glColorTableParameterfvSGI(uint target, uint pname, float[] parameters); + private delegate void glColorTableParameterivSGI(uint target, uint pname, int[] parameters); + private delegate void glCopyColorTableSGI(uint target, uint internalformat, int x, int y, uint width); + private delegate void glGetColorTableSGI(uint target, uint format, uint type, IntPtr table); + private delegate void glGetColorTableParameterfvSGI(uint target, uint pname, float[] parameters); + private delegate void glGetColorTableParameterivSGI(uint target, uint pname, int[] parameters); + + // Constants + public const uint GL_COLOR_TABLE_SGI = 0x80D0; + public const uint GL_POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D1; + public const uint GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D2; + public const uint GL_PROXY_COLOR_TABLE_SGI = 0x80D3; + public const uint GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D4; + public const uint GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D5; + public const uint GL_COLOR_TABLE_SCALE_SGI = 0x80D6; + public const uint GL_COLOR_TABLE_BIAS_SGI = 0x80D7; + public const uint GL_COLOR_TABLE_FORMAT_SGI = 0x80D8; + public const uint GL_COLOR_TABLE_WIDTH_SGI = 0x80D9; + public const uint GL_COLOR_TABLE_RED_SIZE_SGI = 0x80DA; + public const uint GL_COLOR_TABLE_GREEN_SIZE_SGI = 0x80DB; + public const uint GL_COLOR_TABLE_BLUE_SIZE_SGI = 0x80DC; + public const uint GL_COLOR_TABLE_ALPHA_SIZE_SGI = 0x80DD; + public const uint GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = 0x80DE; + public const uint GL_COLOR_TABLE_INTENSITY_SIZE_SGI = 0x80DF; + + #endregion + + #region GL_EXT_convolution + + // Methods. + public void ConvolutionFilter1DEXT(uint target, uint internalformat, int width, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, internalformat, width, format, type, image); + } + + public void ConvolutionFilter2DEXT(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, internalformat, width, height, format, type, image); + } + + public void ConvolutionParameterEXT(uint target, uint pname, float parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void ConvolutionParameterEXT(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void ConvolutionParameterEXT(uint target, uint pname, int parameter) + { + GetDelegateFor()(target, pname, parameter); + } + + public void ConvolutionParameterEXT(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void CopyConvolutionFilter1DEXT(uint target, uint internalformat, int x, int y, int width) + { + GetDelegateFor()(target, internalformat, x, y, width); + } + + public void CopyConvolutionFilter2DEXT(uint target, uint internalformat, int x, int y, int width, int height) + { + GetDelegateFor()(target, internalformat, x, y, width, height); + } + + public void GetConvolutionFilterEXT(uint target, uint format, uint type, IntPtr image) + { + GetDelegateFor()(target, format, type, image); + } + + public void GetConvolutionParameterfvEXT(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetConvolutionParameterivEXT(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetSeparableFilterEXT(uint target, uint format, uint type, IntPtr row, IntPtr column, IntPtr span) + { + GetDelegateFor()(target, format, type, row, column, span); + } + + public void SeparableFilter2DEXT(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr row, IntPtr column) + { + GetDelegateFor()(target, internalformat, width, height, format, type, row, column); + } + + // Delegates + private delegate void glConvolutionFilter1DEXT(uint target, uint internalformat, int width, uint format, uint type, IntPtr image); + private delegate void glConvolutionFilter2DEXT(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr image); + private delegate void glConvolutionParameterfEXT(uint target, uint pname, float parameters); + private delegate void glConvolutionParameterfvEXT(uint target, uint pname, float[] parameters); + private delegate void glConvolutionParameteriEXT(uint target, uint pname, int parameter); + private delegate void glConvolutionParameterivEXT(uint target, uint pname, int[] parameters); + private delegate void glCopyConvolutionFilter1DEXT(uint target, uint internalformat, int x, int y, int width); + private delegate void glCopyConvolutionFilter2DEXT(uint target, uint internalformat, int x, int y, int width, int height); + private delegate void glGetConvolutionFilterEXT(uint target, uint format, uint type, IntPtr image); + private delegate void glGetConvolutionParameterfvEXT(uint target, uint pname, float[] parameters); + private delegate void glGetConvolutionParameterivEXT(uint target, uint pname, int[] parameters); + private delegate void glGetSeparableFilterEXT(uint target, uint format, uint type, IntPtr row, IntPtr column, IntPtr span); + private delegate void glSeparableFilter2DEXT(uint target, uint internalformat, int width, int height, uint format, uint type, IntPtr row, IntPtr column); + + // Constants + public static uint GL_CONVOLUTION_1D_EXT = 0x8010; + public static uint GL_CONVOLUTION_2D_EXT = 0x8011; + public static uint GL_SEPARABLE_2D_EXT = 0x8012; + public static uint GL_CONVOLUTION_BORDER_MODE_EXT = 0x8013; + public static uint GL_CONVOLUTION_FILTER_SCALE_EXT = 0x8014; + public static uint GL_CONVOLUTION_FILTER_BIAS_EXT = 0x8015; + public static uint GL_REDUCE_EXT = 0x8016; + public static uint GL_CONVOLUTION_FORMAT_EXT = 0x8017; + public static uint GL_CONVOLUTION_WIDTH_EXT = 0x8018; + public static uint GL_CONVOLUTION_HEIGHT_EXT = 0x8019; + public static uint GL_MAX_CONVOLUTION_WIDTH_EXT = 0x801A; + public static uint GL_MAX_CONVOLUTION_HEIGHT_EXT = 0x801B; + public static uint GL_POST_CONVOLUTION_RED_SCALE_EXT = 0x801C; + public static uint GL_POST_CONVOLUTION_GREEN_SCALE_EXT = 0x801D; + public static uint GL_POST_CONVOLUTION_BLUE_SCALE_EXT = 0x801E; + public static uint GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = 0x801F; + public static uint GL_POST_CONVOLUTION_RED_BIAS_EXT = 0x8020; + public static uint GL_POST_CONVOLUTION_GREEN_BIAS_EXT = 0x8021; + public static uint GL_POST_CONVOLUTION_BLUE_BIAS_EXT = 0x8022; + public static uint GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = 0x8023; + + #endregion + + #region GL_SGI_color_matrix + + public const uint GL_COLOR_MATRIX_SGI = 0x80B1; + public const uint GL_COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B2; + public const uint GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B3; + public const uint GL_POST_COLOR_MATRIX_RED_SCALE_SGI = 0x80B4; + public const uint GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = 0x80B5; + public const uint GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = 0x80B6; + public const uint GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = 0x80B7; + public const uint GL_POST_COLOR_MATRIX_RED_BIAS_SGI = 0x80B8; + public const uint GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = 0x80B9; + public const uint GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = 0x80BA; + public const uint GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = 0x80BB; + + #endregion + + #region GL_EXT_histogram + + // Methods + public void GetHistogramEXT(uint target, bool reset, uint format, uint type, IntPtr values) + { + GetDelegateFor()(target, reset, format, type, values); + } + + public void GetHistogramParameterEXT(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetHistogramParameterEXT(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetMinmaxEXT(uint target, bool reset, uint format, uint type, IntPtr values) + { + GetDelegateFor()(target, reset, format, type, values); + } + + public void GetMinmaxParameterfvEXT(uint target, uint pname, float[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void GetMinmaxParameterivEXT(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void HistogramEXT(uint target, int width, uint internalformat, bool sink) + { + GetDelegateFor()(target, width, internalformat, sink); + } + + public void MinmaxEXT(uint target, uint internalformat, bool sink) + { + GetDelegateFor()(target, internalformat, sink); + } + + public void ResetHistogramEXT(uint target) + { + GetDelegateFor()(target); + } + + public void ResetMinmaxEXT(uint target) + { + GetDelegateFor()(target); + } + + // Delegates + private delegate void glGetHistogramEXT(uint target, bool reset, uint format, uint type, IntPtr values); + private delegate void glGetHistogramParameterfvEXT(uint target, uint pname, float[] parameters); + private delegate void glGetHistogramParameterivEXT(uint target, uint pname, int[] parameters); + private delegate void glGetMinmaxEXT(uint target, bool reset, uint format, uint type, IntPtr values); + private delegate void glGetMinmaxParameterfvEXT(uint target, uint pname, float[] parameters); + private delegate void glGetMinmaxParameterivEXT(uint target, uint pname, int[] parameters); + private delegate void glHistogramEXT(uint target, int width, uint internalformat, bool sink); + private delegate void glMinmaxEXT(uint target, uint internalformat, bool sink); + private delegate void glResetHistogramEXT(uint target); + private delegate void glResetMinmaxEXT(uint target); + + // Constants + public const uint GL_HISTOGRAM_EXT = 0x8024; + public const uint GL_PROXY_HISTOGRAM_EXT = 0x8025; + public const uint GL_HISTOGRAM_WIDTH_EXT = 0x8026; + public const uint GL_HISTOGRAM_FORMAT_EXT = 0x8027; + public const uint GL_HISTOGRAM_RED_SIZE_EXT = 0x8028; + public const uint GL_HISTOGRAM_GREEN_SIZE_EXT = 0x8029; + public const uint GL_HISTOGRAM_BLUE_SIZE_EXT = 0x802A; + public const uint GL_HISTOGRAM_ALPHA_SIZE_EXT = 0x802B; + public const uint GL_HISTOGRAM_LUMINANCE_SIZE_EXT = 0x802C; + public const uint GL_HISTOGRAM_SINK_EXT = 0x802D; + public const uint GL_MINMAX_EXT = 0x802E; + public const uint GL_MINMAX_FORMAT_EXT = 0x802F; + public const uint GL_MINMAX_SINK_EXT = 0x8030; + public const uint GL_TABLE_TOO_LARGE_EXT = 0x8031; + + #endregion + + #region GL_EXT_blend_color + + // Methods + public void BlendColorEXT(float red, float green, float blue, float alpha) + { + GetDelegateFor()(red, green, blue, alpha); + } + + // Delegates + private delegate void glBlendColorEXT(float red, float green, float blue, float alpha); + + // Constants + public const uint GL_CONSTANT_COLOR_EXT = 0x8001; + public const uint GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002; + public const uint GL_CONSTANT_ALPHA_EXT = 0x8003; + public const uint GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004; + public const uint GL_BLEND_COLOR_EXT = 0x8005; + + #endregion + + #region GL_EXT_blend_minmax + + // Methods + public void BlendEquationEXT(uint mode) + { + GetDelegateFor()(mode); + } + + // Delegates + private delegate void glBlendEquationEXT(uint mode); + + // Constants + public const uint GL_FUNC_ADD_EXT = 0x8006; + public const uint GL_MIN_EXT = 0x8007; + public const uint GL_MAX_EXT = 0x8008; + public const uint GL_FUNC_SUBTRACT_EXT = 0x800A; + public const uint GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B; + public const uint GL_BLEND_EQUATION_EXT = 0x8009; + + #endregion + + #region GL_ARB_multitexture + + // Methods + [Obsolete("Deprecated from OpenGL version 3.0")] + public void ActiveTextureARB(uint texture) + { + GetDelegateFor()(texture); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void ClientActiveTextureARB(uint texture) + { + GetDelegateFor()(texture); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, double s) + { + GetDelegateFor()(target, s); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, float s) + { + GetDelegateFor()(target, s); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, int s) + { + GetDelegateFor()(target, s); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, short s) + { + GetDelegateFor()(target, s); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord1ARB(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, double s, double t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, float s, float t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, int s, int t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, short s, short t) + { + GetDelegateFor()(target, s, t); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord2ARB(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, double s, double t, double r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, float s, float t, float r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, int s, int t, int r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, short s, short t, short r) + { + GetDelegateFor()(target, s, t, r); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord3ARB(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, double s, double t, double r, double q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, double[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, float s, float t, float r, float q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, float[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, int s, int t, int r, int q) + { + GetDelegateFor()(target, s, t, r, q); + } + public void MultiTexCoord4ARB(uint target, int[] v) + { + GetDelegateFor()(target, v); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, short s, short t, short r, short q) + { + GetDelegateFor()(target, s, t, r, q); + } + [Obsolete("Deprecated from OpenGL version 3.0")] + public void MultiTexCoord4ARB(uint target, short[] v) + { + GetDelegateFor()(target, v); + } + + // Delegates + private delegate void glActiveTextureARB(uint texture); + private delegate void glClientActiveTextureARB(uint texture); + private delegate void glMultiTexCoord1dARB(uint target, double s); + private delegate void glMultiTexCoord1dvARB(uint target, double[] v); + private delegate void glMultiTexCoord1fARB(uint target, float s); + private delegate void glMultiTexCoord1fvARB(uint target, float[] v); + private delegate void glMultiTexCoord1iARB(uint target, int s); + private delegate void glMultiTexCoord1ivARB(uint target, int[] v); + private delegate void glMultiTexCoord1sARB(uint target, short s); + private delegate void glMultiTexCoord1svARB(uint target, short[] v); + private delegate void glMultiTexCoord2dARB(uint target, double s, double t); + private delegate void glMultiTexCoord2dvARB(uint target, double[] v); + private delegate void glMultiTexCoord2fARB(uint target, float s, float t); + private delegate void glMultiTexCoord2fvARB(uint target, float[] v); + private delegate void glMultiTexCoord2iARB(uint target, int s, int t); + private delegate void glMultiTexCoord2ivARB(uint target, int[] v); + private delegate void glMultiTexCoord2sARB(uint target, short s, short t); + private delegate void glMultiTexCoord2svARB(uint target, short[] v); + private delegate void glMultiTexCoord3dARB(uint target, double s, double t, double r); + private delegate void glMultiTexCoord3dvARB(uint target, double[] v); + private delegate void glMultiTexCoord3fARB(uint target, float s, float t, float r); + private delegate void glMultiTexCoord3fvARB(uint target, float[] v); + private delegate void glMultiTexCoord3iARB(uint target, int s, int t, int r); + private delegate void glMultiTexCoord3ivARB(uint target, int[] v); + private delegate void glMultiTexCoord3sARB(uint target, short s, short t, short r); + private delegate void glMultiTexCoord3svARB(uint target, short[] v); + private delegate void glMultiTexCoord4dARB(uint target, double s, double t, double r, double q); + private delegate void glMultiTexCoord4dvARB(uint target, double[] v); + private delegate void glMultiTexCoord4fARB(uint target, float s, float t, float r, float q); + private delegate void glMultiTexCoord4fvARB(uint target, float[] v); + private delegate void glMultiTexCoord4iARB(uint target, int s, int t, int r, int q); + private delegate void glMultiTexCoord4ivARB(uint target, int[] v); + private delegate void glMultiTexCoord4sARB(uint target, short s, short t, short r, short q); + private delegate void glMultiTexCoord4svARB(uint target, short[] v); + + // Constants + public const uint GL_TEXTURE0_ARB = 0x84C0; + public const uint GL_TEXTURE1_ARB = 0x84C1; + public const uint GL_TEXTURE2_ARB = 0x84C2; + public const uint GL_TEXTURE3_ARB = 0x84C3; + public const uint GL_TEXTURE4_ARB = 0x84C4; + public const uint GL_TEXTURE5_ARB = 0x84C5; + public const uint GL_TEXTURE6_ARB = 0x84C6; + public const uint GL_TEXTURE7_ARB = 0x84C7; + public const uint GL_TEXTURE8_ARB = 0x84C8; + public const uint GL_TEXTURE9_ARB = 0x84C9; + public const uint GL_TEXTURE10_ARB = 0x84CA; + public const uint GL_TEXTURE11_ARB = 0x84CB; + public const uint GL_TEXTURE12_ARB = 0x84CC; + public const uint GL_TEXTURE13_ARB = 0x84CD; + public const uint GL_TEXTURE14_ARB = 0x84CE; + public const uint GL_TEXTURE15_ARB = 0x84CF; + public const uint GL_TEXTURE16_ARB = 0x84D0; + public const uint GL_TEXTURE17_ARB = 0x84D1; + public const uint GL_TEXTURE18_ARB = 0x84D2; + public const uint GL_TEXTURE19_ARB = 0x84D3; + public const uint GL_TEXTURE20_ARB = 0x84D4; + public const uint GL_TEXTURE21_ARB = 0x84D5; + public const uint GL_TEXTURE22_ARB = 0x84D6; + public const uint GL_TEXTURE23_ARB = 0x84D7; + public const uint GL_TEXTURE24_ARB = 0x84D8; + public const uint GL_TEXTURE25_ARB = 0x84D9; + public const uint GL_TEXTURE26_ARB = 0x84DA; + public const uint GL_TEXTURE27_ARB = 0x84DB; + public const uint GL_TEXTURE28_ARB = 0x84DC; + public const uint GL_TEXTURE29_ARB = 0x84DD; + public const uint GL_TEXTURE30_ARB = 0x84DE; + public const uint GL_TEXTURE31_ARB = 0x84DF; + public const uint GL_ACTIVE_TEXTURE_ARB = 0x84E0; + public const uint GL_CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1; + public const uint GL_MAX_TEXTURE_UNITS_ARB = 0x84E2; + + #endregion + + #region GL_ARB_texture_compression + + // Methods + public void CompressedTexImage3DARB(uint target, int level, uint internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, height, depth, border, imageSize, data); + } + public void CompressedTexImage2DARB(uint target, int level, uint internalformat, int width, int height, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, height, border, imageSize, data); + } + public void CompressedTexImage1DARB(uint target, int level, uint internalformat, int width, int border, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, internalformat, width, border, imageSize, data); + } + public void CompressedTexSubImage3DARB(uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + } + public void CompressedTexSubImage2DARB(uint target, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, yoffset, width, height, format, imageSize, data); + } + public void CompressedTexSubImage1DARB(uint target, int level, int xoffset, int width, uint format, int imageSize, IntPtr data) + { + GetDelegateFor()(target, level, xoffset, width, format, imageSize, data); + } + + // Delegates + private delegate void glCompressedTexImage3DARB(uint target, int level, uint internalformat, int width, int height, int depth, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexImage2DARB(uint target, int level, uint internalformat, int width, int height, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexImage1DARB(uint target, int level, uint internalformat, int width, int border, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage3DARB(uint target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage2DARB(uint target, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, IntPtr data); + private delegate void glCompressedTexSubImage1DARB(uint target, int level, int xoffset, int width, uint format, int imageSize, IntPtr data); + private delegate void glGetCompressedTexImageARB(uint target, int level, IntPtr img); + + // Constants + public const uint GL_COMPRESSED_ALPHA_ARB = 0x84E9; + public const uint GL_COMPRESSED_LUMINANCE_ARB = 0x84EA; + public const uint GL_COMPRESSED_LUMINANCE_ALPHA_ARB = 0x84EB; + public const uint GL_COMPRESSED_INTENSITY_ARB = 0x84EC; + public const uint GL_COMPRESSED_RGB_ARB = 0x84ED; + public const uint GL_COMPRESSED_RGBA_ARB = 0x84EE; + public const uint GL_TEXTURE_COMPRESSION_HINT_ARB = 0x84EF; + public const uint GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 0x86A0; + public const uint GL_TEXTURE_COMPRESSED_ARB = 0x86A1; + public const uint GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2; + public const uint GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3; + + #endregion + + #region GL_EXT_texture_cube_map + + // Constants + public const uint GL_NORMAL_MAP_EXT = 0x8511; + public const uint GL_REFLECTION_MAP_EXT = 0x8512; + public const uint GL_TEXTURE_CUBE_MAP_EXT = 0x8513; + public const uint GL_TEXTURE_BINDING_CUBE_MAP_EXT = 0x8514; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT = 0x8515; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = 0x8516; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = 0x8517; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = 0x8518; + public const uint GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = 0x8519; + public const uint GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = 0x851A; + public const uint GL_PROXY_TEXTURE_CUBE_MAP_EXT = 0x851B; + public const uint GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT = 0x851C; + + #endregion + + #region GL_ARB_multisample + + // Methods + public void SampleCoverageARB(float value, bool invert) + { + GetDelegateFor()(value, invert); + } + + // Delegates + private delegate void glSampleCoverageARB(float value, bool invert); + + // Constants + public const uint GL_MULTISAMPLE_ARB = 0x809D; + public const uint GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 0x809E; + public const uint GL_SAMPLE_ALPHA_TO_ONE_ARB = 0x809F; + public const uint GL_SAMPLE_COVERAGE_ARB = 0x80A0; + public const uint GL_SAMPLE_BUFFERS_ARB = 0x80A8; + public const uint GL_SAMPLES_ARB = 0x80A9; + public const uint GL_SAMPLE_COVERAGE_VALUE_ARB = 0x80AA; + public const uint GL_SAMPLE_COVERAGE_INVERT_ARB = 0x80AB; + public const uint GL_MULTISAMPLE_BIT_ARB = 0x20000000; + + #endregion + + #region GL_ARB_texture_env_add + + // Appears to not have any functionality + + #endregion + + #region GL_ARB_texture_env_combine + + // Constants + public const uint GL_COMBINE_ARB = 0x8570; + public const uint GL_COMBINE_RGB_ARB = 0x8571; + public const uint GL_COMBINE_ALPHA_ARB = 0x8572; + public const uint GL_SOURCE0_RGB_ARB = 0x8580; + public const uint GL_SOURCE1_RGB_ARB = 0x8581; + public const uint GL_SOURCE2_RGB_ARB = 0x8582; + public const uint GL_SOURCE0_ALPHA_ARB = 0x8588; + public const uint GL_SOURCE1_ALPHA_ARB = 0x8589; + public const uint GL_SOURCE2_ALPHA_ARB = 0x858A; + public const uint GL_OPERAND0_RGB_ARB = 0x8590; + public const uint GL_OPERAND1_RGB_ARB = 0x8591; + public const uint GL_OPERAND2_RGB_ARB = 0x8592; + public const uint GL_OPERAND0_ALPHA_ARB = 0x8598; + public const uint GL_OPERAND1_ALPHA_ARB = 0x8599; + public const uint GL_OPERAND2_ALPHA_ARB = 0x859A; + public const uint GL_RGB_SCALE_ARB = 0x8573; + public const uint GL_ADD_SIGNED_ARB = 0x8574; + public const uint GL_INTERPOLATE_ARB = 0x8575; + public const uint GL_SUBTRACT_ARB = 0x84E7; + public const uint GL_CONSTANT_ARB = 0x8576; + public const uint GL_PRIMARY_COLOR_ARB = 0x8577; + public const uint GL_PREVIOUS_ARB = 0x8578; + + #endregion + + #region GL_ARB_texture_env_dot3 + + // Constants + public const uint GL_DOT3_RGB_ARB = 0x86AE; + public const uint GL_DOT3_RGBA_ARB = 0x86AF; + + #endregion + + #region GL_ARB_texture_border_clamp + + // Constants + public const uint GL_CLAMP_TO_BORDER_ARB = 0x812D; + + #endregion + + #region GL_ARB_transpose_matrix + + // Methods + public void glLoadTransposeMatrixARB(float[] m) + { + GetDelegateFor()(m); + } + public void glLoadTransposeMatrixARB(double[] m) + { + GetDelegateFor()(m); + } + public void glMultTransposeMatrixARB(float[] m) + { + GetDelegateFor()(m); + } + public void glMultTransposeMatrixARB(double[] m) + { + GetDelegateFor()(m); + } + + // Delegates + private delegate void glLoadTransposeMatrixfARB(float[] m); + private delegate void glLoadTransposeMatrixdARB(double[] m); + private delegate void glMultTransposeMatrixfARB(float[] m); + private delegate void glMultTransposeMatrixdARB(double[] m); + + // Constants + public const uint GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = 0x84E3; + public const uint GL_TRANSPOSE_PROJECTION_MATRIX_ARB = 0x84E4; + public const uint GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5; + public const uint GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6; + + #endregion + + #region GL_SGIS_generate_mipmap + + // Constants + public const uint GL_GENERATE_MIPMAP_SGIS = 0x8191; + public const uint GL_GENERATE_MIPMAP_HINT_SGIS = 0x8192; + + #endregion + + #region GL_NV_blend_square + + // Appears to be empty. + + #endregion + + #region GL_ARB_depth_texture + + // Constants + public const uint GL_DEPTH_COMPONENT16_ARB = 0x81A5; + public const uint GL_DEPTH_COMPONENT24_ARB = 0x81A6; + public const uint GL_DEPTH_COMPONENT32_ARB = 0x81A7; + public const uint GL_TEXTURE_DEPTH_SIZE_ARB = 0x884A; + public const uint GL_DEPTH_TEXTURE_MODE_ARB = 0x884B; + + #endregion + + #region GL_ARB_shadow + + // Constants + public const uint GL_TEXTURE_COMPARE_MODE_ARB = 0x884C; + public const uint GL_TEXTURE_COMPARE_FUNC_ARB = 0x884D; + public const uint GL_COMPARE_R_TO_TEXTURE_ARB = 0x884E; + + #endregion + + #region GL_EXT_fog_coord + + // Methods + public void FogCoordEXT(float coord) + { + GetDelegateFor()(coord); + } + public void FogCoordEXT(float[] coord) + { + GetDelegateFor()(coord); + } + public void FogCoordEXT(double coord) + { + GetDelegateFor()(coord); + } + public void FogCoordEXT(double[] coord) + { + GetDelegateFor()(coord); + } + public void FogCoordPointerEXT(uint type, int stride, IntPtr pointer) + { + GetDelegateFor()(type, stride, pointer); + } + + // Delegates + private delegate void glFogCoordfEXT(float coord); + private delegate void glFogCoordfvEXT(float[] coord); + private delegate void glFogCoorddEXT(double coord); + private delegate void glFogCoorddvEXT(double[] coord); + private delegate void glFogCoordPointerEXT(uint type, int stride, IntPtr pointer); + + // Constants + public const uint GL_FOG_COORDINATE_SOURCE_EXT = 0x8450; + public const uint GL_FOG_COORDINATE_EXT = 0x8451; + public const uint GL_FRAGMENT_DEPTH_EXT = 0x8452; + public const uint GL_CURRENT_FOG_COORDINATE_EXT = 0x8453; + public const uint GL_FOG_COORDINATE_ARRAY_TYPE_EXT = 0x8454; + public const uint GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = 0x8455; + public const uint GL_FOG_COORDINATE_ARRAY_POINTER_EXT = 0x8456; + public const uint GL_FOG_COORDINATE_ARRAY_EXT = 0x8457; + + #endregion + + #region GL_EXT_multi_draw_arrays + + // Methods + public void MultiDrawArraysEXT(uint mode, int[] first, int[] count, int primcount) + { + GetDelegateFor()(mode, first, count, primcount); + } + public void MultiDrawElementsEXT(uint mode, int[] count, uint type, IntPtr indices, int primcount) + { + GetDelegateFor()(mode, count, type, indices, primcount); + } + + // Delegates + private delegate void glMultiDrawArraysEXT(uint mode, int[] first, int[] count, int primcount); + private delegate void glMultiDrawElementsEXT(uint mode, int[] count, uint type, IntPtr indices, int primcount); + + #endregion + + #region GL_ARB_point_parameters + + // Methods + public void glPointParameterARB(uint pname, float parameter) + { + GetDelegateFor()(pname, parameter); + } + public void glPointParameterARB(uint pname, float[] parameters) + { + GetDelegateFor()(pname, parameters); + } + + // Delegates + private delegate void glPointParameterfARB(uint pname, float param); + private delegate void glPointParameterfvARB(uint pname, float[] parameters); + + // Constants + public const uint GL_POINT_SIZE_MIN_ARB = 0x8126; + public const uint GL_POINT_SIZE_MAX_ARB = 0x8127; + public const uint GL_POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128; + public const uint GL_POINT_DISTANCE_ATTENUATION_ARB = 0x8129; + + #endregion + + #region GL_EXT_secondary_color + + // Methods + public void SecondaryColor3EXT(sbyte red, sbyte green, sbyte blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(sbyte[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(double red, double green, double blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(double[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(float red, float green, float blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(float[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(int red, int green, int blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(int[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(short red, short green, short blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(short[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(byte red, byte green, byte blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(byte[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(uint red, uint green, uint blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(uint[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColor3EXT(ushort red, ushort green, ushort blue) + { + GetDelegateFor()(red, green, blue); + } + public void SecondaryColor3EXT(ushort[] v) + { + GetDelegateFor()(v); + } + public void SecondaryColorPointerEXT(int size, uint type, int stride, IntPtr pointer) + { + GetDelegateFor()(size, type, stride, pointer); + } + + // Delegates + private delegate void glSecondaryColor3bEXT(sbyte red, sbyte green, sbyte blue); + private delegate void glSecondaryColor3bvEXT(sbyte[] v); + private delegate void glSecondaryColor3dEXT(double red, double green, double blue); + private delegate void glSecondaryColor3dvEXT(double[] v); + private delegate void glSecondaryColor3fEXT(float red, float green, float blue); + private delegate void glSecondaryColor3fvEXT(float[] v); + private delegate void glSecondaryColor3iEXT(int red, int green, int blue); + private delegate void glSecondaryColor3ivEXT(int[] v); + private delegate void glSecondaryColor3sEXT(short red, short green, short blue); + private delegate void glSecondaryColor3svEXT(short[] v); + private delegate void glSecondaryColor3ubEXT(byte red, byte green, byte blue); + private delegate void glSecondaryColor3ubvEXT(byte[] v); + private delegate void glSecondaryColor3uiEXT(uint red, uint green, uint blue); + private delegate void glSecondaryColor3uivEXT(uint[] v); + private delegate void glSecondaryColor3usEXT(ushort red, ushort green, ushort blue); + private delegate void glSecondaryColor3usvEXT(ushort[] v); + private delegate void glSecondaryColorPointerEXT(int size, uint type, int stride, IntPtr pointer); + + // Constants + public const uint GL_COLOR_SUM_EXT = 0x8458; + public const uint GL_CURRENT_SECONDARY_COLOR_EXT = 0x8459; + public const uint GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = 0x845A; + public const uint GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = 0x845B; + public const uint GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 0x845C; + public const uint GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D; + public const uint GL_SECONDARY_COLOR_ARRAY_EXT = 0x845E; + + #endregion + + #region GL_EXT_blend_func_separate + + // Methods + public void BlendFuncSeparateEXT(uint sfactorRGB, uint dfactorRGB, uint sfactorAlpha, uint dfactorAlpha) + { + GetDelegateFor()(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + } + + // Delegates + private delegate void glBlendFuncSeparateEXT(uint sfactorRGB, uint dfactorRGB, uint sfactorAlpha, uint dfactorAlpha); + + // Constants + public const uint GL_BLEND_DST_RGB_EXT = 0x80C8; + public const uint GL_BLEND_SRC_RGB_EXT = 0x80C9; + public const uint GL_BLEND_DST_ALPHA_EXT = 0x80CA; + public const uint GL_BLEND_SRC_ALPHA_EXT = 0x80CB; + + #endregion + + #region GL_EXT_stencil_wrap + + // Constants + public const uint GL_INCR_WRAP_EXT = 0x8507; + public const uint GL_DECR_WRAP_EXT = 0x8508; + + #endregion + + #region GL_ARB_texture_env_crossbar + + // No methods or constants. + + #endregion + + #region GL_EXT_texture_lod_bias + + // Constants + public const uint GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD; + public const uint GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500; + public const uint GL_TEXTURE_LOD_BIAS_EXT = 0x8501; + + #endregion + + #region GL_ARB_texture_mirrored_repeat + + // Constants + public const uint GL_MIRRORED_REPEAT_ARB = 0x8370; + + #endregion + + #region GL_ARB_window_pos + + // Methods + public void WindowPos2ARB(double x, double y) + { + GetDelegateFor()(x, y); + } + public void WindowPos2ARB(double[] v) + { + GetDelegateFor()(v); + } + public void WindowPos2ARB(float x, float y) + { + GetDelegateFor()(x, y); + } + public void WindowPos2ARB(float[] v) + { + GetDelegateFor()(v); + } + public void WindowPos2ARB(int x, int y) + { + GetDelegateFor()(x, y); + } + public void WindowPos2ARB(int[] v) + { + GetDelegateFor()(v); + } + public void WindowPos2ARB(short x, short y) + { + GetDelegateFor()(x, y); + } + public void WindowPos2ARB(short[] v) + { + GetDelegateFor()(v); + } + public void WindowPos3ARB(double x, double y, double z) + { + GetDelegateFor()(x, y, z); + } + public void WindowPos3ARB(double[] v) + { + GetDelegateFor()(v); + } + public void WindowPos3ARB(float x, float y, float z) + { + GetDelegateFor()(x, y, z); + } + public void WindowPos3ARB(float[] v) + { + GetDelegateFor()(v); + } + public void WindowPos3ARB(int x, int y, int z) + { + GetDelegateFor()(x, y, z); + } + public void WindowPos3ARB(int[] v) + { + GetDelegateFor()(v); + } + public void WindowPos3ARB(short x, short y, short z) + { + GetDelegateFor()(x, y, z); + } + public void WindowPos3ARB(short[] v) + { + GetDelegateFor()(v); + } + + // Delegates + private delegate void glWindowPos2dARB(double x, double y); + private delegate void glWindowPos2dvARB(double[] v); + private delegate void glWindowPos2fARB(float x, float y); + private delegate void glWindowPos2fvARB(float[] v); + private delegate void glWindowPos2iARB(int x, int y); + private delegate void glWindowPos2ivARB(int[] v); + private delegate void glWindowPos2sARB(short x, short y); + private delegate void glWindowPos2svARB(short[] v); + private delegate void glWindowPos3dARB(double x, double y, double z); + private delegate void glWindowPos3dvARB(double[] v); + private delegate void glWindowPos3fARB(float x, float y, float z); + private delegate void glWindowPos3fvARB(float[] v); + private delegate void glWindowPos3iARB(int x, int y, int z); + private delegate void glWindowPos3ivARB(int[] v); + private delegate void glWindowPos3sARB(short x, short y, short z); + private delegate void glWindowPos3svARB(short[] v); + + #endregion + + #region GL_ARB_vertex_buffer_object + + // Methods + public void BindBufferARB(uint target, uint buffer) + { + GetDelegateFor()(target, buffer); + } + public void DeleteBuffersARB(int n, uint[] buffers) + { + GetDelegateFor()(n, buffers); + } + public void GenBuffersARB(int n, uint[] buffers) + { + GetDelegateFor()(n, buffers); + } + public bool IsBufferARB(uint buffer) + { + return (bool)GetDelegateFor()(buffer); + } + public void BufferDataARB(uint target, uint size, IntPtr data, uint usage) + { + GetDelegateFor()(target, size, data, usage); + } + public void BufferSubDataARB(uint target, uint offset, uint size, IntPtr data) + { + GetDelegateFor()(target, offset, size, data); + } + public void GetBufferSubDataARB(uint target, uint offset, uint size, IntPtr data) + { + GetDelegateFor()(target, offset, size, data); + } + public IntPtr MapBufferARB(uint target, uint access) + { + return (IntPtr)GetDelegateFor()(target, access); + } + public bool UnmapBufferARB(uint target) + { + return (bool)GetDelegateFor()(target); + } + public void GetBufferParameterARB(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetBufferPointerARB(uint target, uint pname, IntPtr parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + // Delegates + private delegate void glBindBufferARB(uint target, uint buffer); + private delegate void glDeleteBuffersARB(int n, uint[] buffers); + private delegate void glGenBuffersARB(int n, uint[] buffers); + private delegate bool glIsBufferARB(uint buffer); + private delegate void glBufferDataARB(uint target, uint size, IntPtr data, uint usage); + private delegate void glBufferSubDataARB(uint target, uint offset, uint size, IntPtr data); + private delegate void glGetBufferSubDataARB(uint target, uint offset, uint size, IntPtr data); + private delegate IntPtr glMapBufferARB(uint target, uint access); + private delegate bool glUnmapBufferARB(uint target); + private delegate void glGetBufferParameterivARB(uint target, uint pname, int[] parameters); + private delegate void glGetBufferPointervARB(uint target, uint pname, IntPtr parameters); + + // Constants + public const uint GL_BUFFER_SIZE_ARB = 0x8764; + public const uint GL_BUFFER_USAGE_ARB = 0x8765; + public const uint GL_ARRAY_BUFFER_ARB = 0x8892; + public const uint GL_ELEMENT_ARRAY_BUFFER_ARB = 0x8893; + public const uint GL_ARRAY_BUFFER_BINDING_ARB = 0x8894; + public const uint GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = 0x8895; + public const uint GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = 0x8896; + public const uint GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = 0x8897; + public const uint GL_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x8898; + public const uint GL_INDEX_ARRAY_BUFFER_BINDING_ARB = 0x8899; + public const uint GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 0x889A; + public const uint GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 0x889B; + public const uint GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x889C; + public const uint GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 0x889D; + public const uint GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = 0x889E; + public const uint GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 0x889F; + public const uint GL_READ_ONLY_ARB = 0x88B8; + public const uint GL_WRITE_ONLY_ARB = 0x88B9; + public const uint GL_READ_WRITE_ARB = 0x88BA; + public const uint GL_BUFFER_ACCESS_ARB = 0x88BB; + public const uint GL_BUFFER_MAPPED_ARB = 0x88BC; + public const uint GL_BUFFER_MAP_POINTER_ARB = 0x88BD; + public const uint GL_STREAM_DRAW_ARB = 0x88E0; + public const uint GL_STREAM_READ_ARB = 0x88E1; + public const uint GL_STREAM_COPY_ARB = 0x88E2; + public const uint GL_STATIC_DRAW_ARB = 0x88E4; + public const uint GL_STATIC_READ_ARB = 0x88E5; + public const uint GL_STATIC_COPY_ARB = 0x88E6; + public const uint GL_DYNAMIC_DRAW_ARB = 0x88E8; + public const uint GL_DYNAMIC_READ_ARB = 0x88E9; + public const uint GL_DYNAMIC_COPY_ARB = 0x88EA; + #endregion + + #region GL_ARB_occlusion_query + + // Methods + public void GenQueriesARB(int n, uint[] ids) + { + GetDelegateFor()(n, ids); + } + public void DeleteQueriesARB(int n, uint[] ids) + { + GetDelegateFor()(n, ids); + } + public bool IsQueryARB(uint id) + { + return (bool)GetDelegateFor()(id); + } + public void BeginQueryARB(uint target, uint id) + { + GetDelegateFor()(target, id); + } + public void EndQueryARB(uint target) + { + GetDelegateFor()(target); + } + public void GetQueryARB(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetQueryObjectARB(uint id, uint pname, int[] parameters) + { + GetDelegateFor()(id, pname, parameters); + } + public void GetQueryObjectARB(uint id, uint pname, uint[] parameters) + { + GetDelegateFor()(id, pname, parameters); + } + + // Delegates + private delegate void glGenQueriesARB(int n, uint[] ids); + private delegate void glDeleteQueriesARB(int n, uint[] ids); + private delegate bool glIsQueryARB(uint id); + private delegate void glBeginQueryARB(uint target, uint id); + private delegate void glEndQueryARB(uint target); + private delegate void glGetQueryivARB(uint target, uint pname, int[] parameters); + private delegate void glGetQueryObjectivARB(uint id, uint pname, int[] parameters); + private delegate void glGetQueryObjectuivARB(uint id, uint pname, uint[] parameters); + + // Constants + public const uint GL_QUERY_COUNTER_BITS_ARB = 0x8864; + public const uint GL_CURRENT_QUERY_ARB = 0x8865; + public const uint GL_QUERY_RESULT_ARB = 0x8866; + public const uint GL_QUERY_RESULT_AVAILABLE_ARB = 0x8867; + public const uint GL_SAMPLES_PASSED_ARB = 0x8914; + public const uint GL_ANY_SAMPLES_PASSED = 0x8C2F; + + #endregion + + #region GL_ARB_shader_objects + + // Methods + public void DeleteObjectARB(uint obj) + { + GetDelegateFor()(obj); + } + public uint GetHandleARB(uint pname) + { + return (uint)GetDelegateFor()(pname); + } + public void DetachObjectARB(uint containerObj, uint attachedObj) + { + GetDelegateFor()(containerObj, attachedObj); + } + public uint CreateShaderObjectARB(uint shaderType) + { + return (uint)GetDelegateFor()(shaderType); + } + public void ShaderSourceARB(uint shaderObj, int count, string[] source, ref int length) + { + GetDelegateFor()(shaderObj, count, source, ref length); + } + public void CompileShaderARB(uint shaderObj) + { + GetDelegateFor()(shaderObj); + } + public uint CreateProgramObjectARB() + { + return (uint)GetDelegateFor()(); + } + public void AttachObjectARB(uint containerObj, uint obj) + { + GetDelegateFor()(containerObj, obj); + } + public void LinkProgramARB(uint programObj) + { + GetDelegateFor()(programObj); + } + public void UseProgramObjectARB(uint programObj) + { + GetDelegateFor()(programObj); + } + public void ValidateProgramARB(uint programObj) + { + GetDelegateFor()(programObj); + } + public void Uniform1ARB(int location, float v0) + { + GetDelegateFor()(location, v0); + } + public void Uniform2ARB(int location, float v0, float v1) + { + GetDelegateFor()(location, v0, v1); + } + public void Uniform3ARB(int location, float v0, float v1, float v2) + { + GetDelegateFor()(location, v0, v1, v2); + } + public void Uniform4ARB(int location, float v0, float v1, float v2, float v3) + { + GetDelegateFor()(location, v0, v1, v2, v3); + } + public void Uniform1ARB(int location, int v0) + { + GetDelegateFor()(location, v0); + } + public void Uniform2ARB(int location, int v0, int v1) + { + GetDelegateFor()(location, v0, v1); + } + public void Uniform3ARB(int location, int v0, int v1, int v2) + { + GetDelegateFor()(location, v0, v1, v2); + } + public void Uniform4ARB(int location, int v0, int v1, int v2, int v3) + { + GetDelegateFor()(location, v0, v1, v2, v3); + } + public void Uniform1ARB(int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform2ARB(int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform3ARB(int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform4ARB(int location, int count, float[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform1ARB(int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform2ARB(int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform3ARB(int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void Uniform4ARB(int location, int count, int[] value) + { + GetDelegateFor()(location, count, value); + } + public void UniformMatrix2ARB(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix3ARB(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void UniformMatrix4ARB(int location, int count, bool transpose, float[] value) + { + GetDelegateFor()(location, count, transpose, value); + } + public void GetObjectParameterARB(uint obj, uint pname, float[] parameters) + { + GetDelegateFor()(obj, pname, parameters); + } + public void GetObjectParameterARB(uint obj, uint pname, int[] parameters) + { + GetDelegateFor()(obj, pname, parameters); + } + public void GetInfoLogARB(uint obj, int maxLength, ref int length, string infoLog) + { + GetDelegateFor()(obj, maxLength, ref length, infoLog); + } + public void GetAttachedObjectsARB(uint containerObj, int maxCount, ref int count, ref uint obj) + { + GetDelegateFor()(containerObj, maxCount, ref count, ref obj); + } + public int GetUniformLocationARB(uint programObj, string name) + { + return (int)GetDelegateFor()(programObj, name); + } + public void GetActiveUniformARB(uint programObj, uint index, int maxLength, ref int length, ref int size, ref uint type, string name) + { + GetDelegateFor()(programObj, index, maxLength, ref length, ref size, ref type, name); + } + public void GetUniformARB(uint programObj, int location, float[] parameters) + { + GetDelegateFor()(programObj, location, parameters); + } + public void GetUniformARB(uint programObj, int location, int[] parameters) + { + GetDelegateFor()(programObj, location, parameters); + } + public void GetShaderSourceARB(uint obj, int maxLength, ref int length, string source) + { + GetDelegateFor()(obj, maxLength, ref length, source); + } + + // Delegates + private delegate void glDeleteObjectARB(uint obj); + private delegate uint glGetHandleARB(uint pname); + private delegate void glDetachObjectARB(uint containerObj, uint attachedObj); + private delegate uint glCreateShaderObjectARB(uint shaderType); + private delegate void glShaderSourceARB(uint shaderObj, int count, string[] source, ref int length); + private delegate void glCompileShaderARB(uint shaderObj); + private delegate uint glCreateProgramObjectARB(); + private delegate void glAttachObjectARB(uint containerObj, uint obj); + private delegate void glLinkProgramARB(uint programObj); + private delegate void glUseProgramObjectARB(uint programObj); + private delegate void glValidateProgramARB(uint programObj); + private delegate void glUniform1fARB(int location, float v0); + private delegate void glUniform2fARB(int location, float v0, float v1); + private delegate void glUniform3fARB(int location, float v0, float v1, float v2); + private delegate void glUniform4fARB(int location, float v0, float v1, float v2, float v3); + private delegate void glUniform1iARB(int location, int v0); + private delegate void glUniform2iARB(int location, int v0, int v1); + private delegate void glUniform3iARB(int location, int v0, int v1, int v2); + private delegate void glUniform4iARB(int location, int v0, int v1, int v2, int v3); + private delegate void glUniform1fvARB(int location, int count, float[] value); + private delegate void glUniform2fvARB(int location, int count, float[] value); + private delegate void glUniform3fvARB(int location, int count, float[] value); + private delegate void glUniform4fvARB(int location, int count, float[] value); + private delegate void glUniform1ivARB(int location, int count, int[] value); + private delegate void glUniform2ivARB(int location, int count, int[] value); + private delegate void glUniform3ivARB(int location, int count, int[] value); + private delegate void glUniform4ivARB(int location, int count, int[] value); + private delegate void glUniformMatrix2fvARB(int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix3fvARB(int location, int count, bool transpose, float[] value); + private delegate void glUniformMatrix4fvARB(int location, int count, bool transpose, float[] value); + private delegate void glGetObjectParameterfvARB(uint obj, uint pname, float[] parameters); + private delegate void glGetObjectParameterivARB(uint obj, uint pname, int[] parameters); + private delegate void glGetInfoLogARB(uint obj, int maxLength, ref int length, string infoLog); + private delegate void glGetAttachedObjectsARB(uint containerObj, int maxCount, ref int count, ref uint obj); + private delegate int glGetUniformLocationARB(uint programObj, string name); + private delegate void glGetActiveUniformARB(uint programObj, uint index, int maxLength, ref int length, ref int size, ref uint type, string name); + private delegate void glGetUniformfvARB(uint programObj, int location, float[] parameters); + private delegate void glGetUniformivARB(uint programObj, int location, int[] parameters); + private delegate void glGetShaderSourceARB(uint obj, int maxLength, ref int length, string source); + + // Constants + public const uint GL_PROGRAM_OBJECT_ARB = 0x8B40; + public const uint GL_SHADER_OBJECT_ARB = 0x8B48; + public const uint GL_OBJECT_TYPE_ARB = 0x8B4E; + public const uint GL_OBJECT_SUBTYPE_ARB = 0x8B4F; + public const uint GL_FLOAT_VEC2_ARB = 0x8B50; + public const uint GL_FLOAT_VEC3_ARB = 0x8B51; + public const uint GL_FLOAT_VEC4_ARB = 0x8B52; + public const uint GL_INT_VEC2_ARB = 0x8B53; + public const uint GL_INT_VEC3_ARB = 0x8B54; + public const uint GL_INT_VEC4_ARB = 0x8B55; + public const uint GL_BOOL_ARB = 0x8B56; + public const uint GL_BOOL_VEC2_ARB = 0x8B57; + public const uint GL_BOOL_VEC3_ARB = 0x8B58; + public const uint GL_BOOL_VEC4_ARB = 0x8B59; + public const uint GL_FLOAT_MAT2_ARB = 0x8B5A; + public const uint GL_FLOAT_MAT3_ARB = 0x8B5B; + public const uint GL_FLOAT_MAT4_ARB = 0x8B5C; + public const uint GL_SAMPLER_1D_ARB = 0x8B5D; + public const uint GL_SAMPLER_2D_ARB = 0x8B5E; + public const uint GL_SAMPLER_3D_ARB = 0x8B5F; + public const uint GL_SAMPLER_CUBE_ARB = 0x8B60; + public const uint GL_SAMPLER_1D_SHADOW_ARB = 0x8B61; + public const uint GL_SAMPLER_2D_SHADOW_ARB = 0x8B62; + public const uint GL_SAMPLER_2D_RECT_ARB = 0x8B63; + public const uint GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64; + public const uint GL_OBJECT_DELETE_STATUS_ARB = 0x8B80; + public const uint GL_OBJECT_COMPILE_STATUS_ARB = 0x8B81; + public const uint GL_OBJECT_LINK_STATUS_ARB = 0x8B82; + public const uint GL_OBJECT_VALIDATE_STATUS_ARB = 0x8B83; + public const uint GL_OBJECT_INFO_LOG_LENGTH_ARB = 0x8B84; + public const uint GL_OBJECT_ATTACHED_OBJECTS_ARB = 0x8B85; + public const uint GL_OBJECT_ACTIVE_UNIFORMS_ARB = 0x8B86; + public const uint GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 0x8B87; + public const uint GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = 0x8B88; + + #endregion + + #region GL_ARB_vertex_program + + // Methods + public void VertexAttrib1ARB(uint index, double x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1ARB(uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib1ARB(uint index, float x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1ARB(uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib1ARB(uint index, short x) + { + GetDelegateFor()(index, x); + } + public void VertexAttrib1ARB(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2ARB(uint index, double x, double y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2ARB(uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2ARB(uint index, float x, float y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2ARB(uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib2ARB(uint index, short x, short y) + { + GetDelegateFor()(index, x, y); + } + public void VertexAttrib2ARB(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3ARB(uint index, double x, double y, double z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3ARB(uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3ARB(uint index, float x, float y, float z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3ARB(uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib3ARB(uint index, short x, short y, short z) + { + GetDelegateFor()(index, x, y, z); + } + public void VertexAttrib3ARB(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, sbyte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, byte x, byte y, byte z, byte w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4NARB(uint index, byte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4NARB(uint index, ushort[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, sbyte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, double x, double y, double z, double w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4ARB(uint index, double[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, float x, float y, float z, float w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4ARB(uint index, float[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, int[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, short x, short y, short z, short w) + { + GetDelegateFor()(index, x, y, z, w); + } + public void VertexAttrib4ARB(uint index, short[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, byte[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, uint[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttrib4ARB(uint index, ushort[] v) + { + GetDelegateFor()(index, v); + } + public void VertexAttribPointerARB(uint index, int size, uint type, bool normalized, int stride, IntPtr pointer) + { + GetDelegateFor()(index, size, type, normalized, stride, pointer); + } + public void EnableVertexAttribArrayARB(uint index) + { + GetDelegateFor()(index); + } + public void DisableVertexAttribArrayARB(uint index) + { + GetDelegateFor()(index); + } + public void ProgramStringARB(uint target, uint format, int len, IntPtr str) + { + GetDelegateFor()(target, format, len, str); + } + public void BindProgramARB(uint target, uint program) + { + GetDelegateFor()(target, program); + } + public void DeleteProgramsARB(int n, uint[] programs) + { + GetDelegateFor()(n, programs); + } + public void GenProgramsARB(int n, uint[] programs) + { + GetDelegateFor()(n, programs); + } + public void ProgramEnvParameter4ARB(uint target, uint index, double x, double y, double z, double w) + { + GetDelegateFor()(target, index, x, y, z, w); + } + public void ProgramEnvParameter4ARB(uint target, uint index, double[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void ProgramEnvParameter4ARB(uint target, uint index, float x, float y, float z, float w) + { + GetDelegateFor()(target, index, x, y, z, w); + } + public void ProgramEnvParameter4ARB(uint target, uint index, float[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void ProgramLocalParameter4ARB(uint target, uint index, double x, double y, double z, double w) + { + GetDelegateFor()(target, index, x, y, z, w); + } + public void ProgramLocalParameter4ARB(uint target, uint index, double[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void ProgramLocalParameter4ARB(uint target, uint index, float x, float y, float z, float w) + { + GetDelegateFor()(target, index, x, y, z, w); + } + public void ProgramLocalParameter4ARB(uint target, uint index, float[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void GetProgramEnvParameterdARB(uint target, uint index, double[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void GetProgramEnvParameterfARB(uint target, uint index, float[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void GetProgramLocalParameterARB(uint target, uint index, double[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void GetProgramLocalParameterARB(uint target, uint index, float[] parameters) + { + GetDelegateFor()(target, index, parameters); + } + public void GetProgramARB(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + public void GetProgramStringARB(uint target, uint pname, IntPtr str) + { + GetDelegateFor()(target, pname, str); + } + public void GetVertexAttribARB(uint index, uint pname, double[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttribARB(uint index, uint pname, float[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttribARB(uint index, uint pname, int[] parameters) + { + GetDelegateFor()(index, pname, parameters); + } + public void GetVertexAttribPointerARB(uint index, uint pname, IntPtr pointer) + { + GetDelegateFor()(index, pname, pointer); + } + + // Delegates + private delegate void glVertexAttrib1dARB(uint index, double x); + private delegate void glVertexAttrib1dvARB(uint index, double[] v); + private delegate void glVertexAttrib1fARB(uint index, float x); + private delegate void glVertexAttrib1fvARB(uint index, float[] v); + private delegate void glVertexAttrib1sARB(uint index, short x); + private delegate void glVertexAttrib1svARB(uint index, short[] v); + private delegate void glVertexAttrib2dARB(uint index, double x, double y); + private delegate void glVertexAttrib2dvARB(uint index, double[] v); + private delegate void glVertexAttrib2fARB(uint index, float x, float y); + private delegate void glVertexAttrib2fvARB(uint index, float[] v); + private delegate void glVertexAttrib2sARB(uint index, short x, short y); + private delegate void glVertexAttrib2svARB(uint index, short[] v); + private delegate void glVertexAttrib3dARB(uint index, double x, double y, double z); + private delegate void glVertexAttrib3dvARB(uint index, double[] v); + private delegate void glVertexAttrib3fARB(uint index, float x, float y, float z); + private delegate void glVertexAttrib3fvARB(uint index, float[] v); + private delegate void glVertexAttrib3sARB(uint index, short x, short y, short z); + private delegate void glVertexAttrib3svARB(uint index, short[] v); + private delegate void glVertexAttrib4NbvARB(uint index, sbyte[] v); + private delegate void glVertexAttrib4NivARB(uint index, int[] v); + private delegate void glVertexAttrib4NsvARB(uint index, short[] v); + private delegate void glVertexAttrib4NubARB(uint index, byte x, byte y, byte z, byte w); + private delegate void glVertexAttrib4NubvARB(uint index, byte[] v); + private delegate void glVertexAttrib4NuivARB(uint index, uint[] v); + private delegate void glVertexAttrib4NusvARB(uint index, ushort[] v); + private delegate void glVertexAttrib4bvARB(uint index, sbyte[] v); + private delegate void glVertexAttrib4dARB(uint index, double x, double y, double z, double w); + private delegate void glVertexAttrib4dvARB(uint index, double[] v); + private delegate void glVertexAttrib4fARB(uint index, float x, float y, float z, float w); + private delegate void glVertexAttrib4fvARB(uint index, float[] v); + private delegate void glVertexAttrib4ivARB(uint index, int[] v); + private delegate void glVertexAttrib4sARB(uint index, short x, short y, short z, short w); + private delegate void glVertexAttrib4svARB(uint index, short[] v); + private delegate void glVertexAttrib4ubvARB(uint index, byte[] v); + private delegate void glVertexAttrib4uivARB(uint index, uint[] v); + private delegate void glVertexAttrib4usvARB(uint index, ushort[] v); + private delegate void glVertexAttribPointerARB(uint index, int size, uint type, bool normalized, int stride, IntPtr pointer); + private delegate void glEnableVertexAttribArrayARB(uint index); + private delegate void glDisableVertexAttribArrayARB(uint index); + private delegate void glProgramStringARB(uint target, uint format, int len, IntPtr str); + private delegate void glBindProgramARB(uint target, uint program); + private delegate void glDeleteProgramsARB(int n, uint[] programs); + private delegate void glGenProgramsARB(int n, uint[] programs); + private delegate void glProgramEnvParameter4dARB(uint target, uint index, double x, double y, double z, double w); + private delegate void glProgramEnvParameter4dvARB(uint target, uint index, double[] parameters); + private delegate void glProgramEnvParameter4fARB(uint target, uint index, float x, float y, float z, float w); + private delegate void glProgramEnvParameter4fvARB(uint target, uint index, float[] parameters); + private delegate void glProgramLocalParameter4dARB(uint target, uint index, double x, double y, double z, double w); + private delegate void glProgramLocalParameter4dvARB(uint target, uint index, double[] parameters); + private delegate void glProgramLocalParameter4fARB(uint target, uint index, float x, float y, float z, float w); + private delegate void glProgramLocalParameter4fvARB(uint target, uint index, float[] parameters); + private delegate void glGetProgramEnvParameterdvARB(uint target, uint index, double[] parameters); + private delegate void glGetProgramEnvParameterfvARB(uint target, uint index, float[] parameters); + private delegate void glGetProgramLocalParameterdvARB(uint target, uint index, double[] parameters); + private delegate void glGetProgramLocalParameterfvARB(uint target, uint index, float[] parameters); + private delegate void glGetProgramivARB(uint target, uint pname, int[] parameters); + private delegate void glGetProgramStringARB(uint target, uint pname, IntPtr str); + private delegate void glGetVertexAttribdvARB(uint index, uint pname, double[] parameters); + private delegate void glGetVertexAttribfvARB(uint index, uint pname, float[] parameters); + private delegate void glGetVertexAttribivARB(uint index, uint pname, int[] parameters); + private delegate void glGetVertexAttribPointervARB(uint index, uint pname, IntPtr pointer); + + // Constants + public const uint GL_COLOR_SUM_ARB = 0x8458; + public const uint GL_VERTEX_PROGRAM_ARB = 0x8620; + public const uint GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; + public const uint GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; + public const uint GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; + public const uint GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625; + public const uint GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; + public const uint GL_PROGRAM_LENGTH_ARB = 0x8627; + public const uint GL_PROGRAM_STRING_ARB = 0x8628; + public const uint GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E; + public const uint GL_MAX_PROGRAM_MATRICES_ARB = 0x862F; + public const uint GL_CURRENT_MATRIX_STACK_DEPTH_ARB = 0x8640; + public const uint GL_CURRENT_MATRIX_ARB = 0x8641; + public const uint GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642; + public const uint GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; + public const uint GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645; + public const uint GL_PROGRAM_ERROR_POSITION_ARB = 0x864B; + public const uint GL_PROGRAM_BINDING_ARB = 0x8677; + public const uint GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; + public const uint GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A; + public const uint GL_PROGRAM_ERROR_STRING_ARB = 0x8874; + public const uint GL_PROGRAM_FORMAT_ASCII_ARB = 0x8875; + public const uint GL_PROGRAM_FORMAT_ARB = 0x8876; + public const uint GL_PROGRAM_INSTRUCTIONS_ARB = 0x88A0; + public const uint GL_MAX_PROGRAM_INSTRUCTIONS_ARB = 0x88A1; + public const uint GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A2; + public const uint GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A3; + public const uint GL_PROGRAM_TEMPORARIES_ARB = 0x88A4; + public const uint GL_MAX_PROGRAM_TEMPORARIES_ARB = 0x88A5; + public const uint GL_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A6; + public const uint GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A7; + public const uint GL_PROGRAM_PARAMETERS_ARB = 0x88A8; + public const uint GL_MAX_PROGRAM_PARAMETERS_ARB = 0x88A9; + public const uint GL_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AA; + public const uint GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AB; + public const uint GL_PROGRAM_ATTRIBS_ARB = 0x88AC; + public const uint GL_MAX_PROGRAM_ATTRIBS_ARB = 0x88AD; + public const uint GL_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AE; + public const uint GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AF; + public const uint GL_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B0; + public const uint GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1; + public const uint GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2; + public const uint GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3; + public const uint GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 0x88B4; + public const uint GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5; + public const uint GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6; + public const uint GL_TRANSPOSE_CURRENT_MATRIX_ARB = 0x88B7; + public const uint GL_MATRIX0_ARB = 0x88C0; + public const uint GL_MATRIX1_ARB = 0x88C1; + public const uint GL_MATRIX2_ARB = 0x88C2; + public const uint GL_MATRIX3_ARB = 0x88C3; + public const uint GL_MATRIX4_ARB = 0x88C4; + public const uint GL_MATRIX5_ARB = 0x88C5; + public const uint GL_MATRIX6_ARB = 0x88C6; + public const uint GL_MATRIX7_ARB = 0x88C7; + public const uint GL_MATRIX8_ARB = 0x88C8; + public const uint GL_MATRIX9_ARB = 0x88C9; + public const uint GL_MATRIX10_ARB = 0x88CA; + public const uint GL_MATRIX11_ARB = 0x88CB; + public const uint GL_MATRIX12_ARB = 0x88CC; + public const uint GL_MATRIX13_ARB = 0x88CD; + public const uint GL_MATRIX14_ARB = 0x88CE; + public const uint GL_MATRIX15_ARB = 0x88CF; + public const uint GL_MATRIX16_ARB = 0x88D0; + public const uint GL_MATRIX17_ARB = 0x88D1; + public const uint GL_MATRIX18_ARB = 0x88D2; + public const uint GL_MATRIX19_ARB = 0x88D3; + public const uint GL_MATRIX20_ARB = 0x88D4; + public const uint GL_MATRIX21_ARB = 0x88D5; + public const uint GL_MATRIX22_ARB = 0x88D6; + public const uint GL_MATRIX23_ARB = 0x88D7; + public const uint GL_MATRIX24_ARB = 0x88D8; + public const uint GL_MATRIX25_ARB = 0x88D9; + public const uint GL_MATRIX26_ARB = 0x88DA; + public const uint GL_MATRIX27_ARB = 0x88DB; + public const uint GL_MATRIX28_ARB = 0x88DC; + public const uint GL_MATRIX29_ARB = 0x88DD; + public const uint GL_MATRIX30_ARB = 0x88DE; + public const uint GL_MATRIX31_ARB = 0x88DF; + + #endregion + + #region GL_ARB_vertex_shader + + // Methods + public void BindAttribLocationARB(uint programObj, uint index, string name) + { + GetDelegateFor()(programObj, index, name); + } + public void GetActiveAttribARB(uint programObj, uint index, int maxLength, int[] length, int[] size, uint[] type, string name) + { + GetDelegateFor()(programObj, index, maxLength, length, size, type, name); + } + public uint GetAttribLocationARB(uint programObj, string name) + { + return (uint)GetDelegateFor()(programObj, name); + } + + // Delegates + private delegate void glBindAttribLocationARB(uint programObj, uint index, string name); + private delegate void glGetActiveAttribARB(uint programObj, uint index, int maxLength, int[] length, int[] size, uint[] type, string name); + private delegate uint glGetAttribLocationARB(uint programObj, string name); + + // Constants + public const uint GL_VERTEX_SHADER_ARB = 0x8B31; + public const uint GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A; + public const uint GL_MAX_VARYING_FLOATS_ARB = 0x8B4B; + public const uint GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C; + public const uint GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 0x8B4D; + public const uint GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89; + public const uint GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A; + + #endregion + + #region GL_ARB_fragment_shader + + public const uint GL_FRAGMENT_SHADER_ARB = 0x8B30; + public const uint GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49; + public const uint GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 0x8B8B; + + #endregion + + #region GL_ARB_draw_buffers + + // Methods + public void DrawBuffersARB(int n, uint[] bufs) + { + GetDelegateFor()(n, bufs); + } + + // Delegates + private delegate void glDrawBuffersARB(int n, uint[] bufs); + + // Constants + public const uint GL_MAX_DRAW_BUFFERS_ARB = 0x8824; + public const uint GL_DRAW_BUFFER0_ARB = 0x8825; + public const uint GL_DRAW_BUFFER1_ARB = 0x8826; + public const uint GL_DRAW_BUFFER2_ARB = 0x8827; + public const uint GL_DRAW_BUFFER3_ARB = 0x8828; + public const uint GL_DRAW_BUFFER4_ARB = 0x8829; + public const uint GL_DRAW_BUFFER5_ARB = 0x882A; + public const uint GL_DRAW_BUFFER6_ARB = 0x882B; + public const uint GL_DRAW_BUFFER7_ARB = 0x882C; + public const uint GL_DRAW_BUFFER8_ARB = 0x882D; + public const uint GL_DRAW_BUFFER9_ARB = 0x882E; + public const uint GL_DRAW_BUFFER10_ARB = 0x882F; + public const uint GL_DRAW_BUFFER11_ARB = 0x8830; + public const uint GL_DRAW_BUFFER12_ARB = 0x8831; + public const uint GL_DRAW_BUFFER13_ARB = 0x8832; + public const uint GL_DRAW_BUFFER14_ARB = 0x8833; + public const uint GL_DRAW_BUFFER15_ARB = 0x8834; + + #endregion + + #region GL_ARB_texture_non_power_of_two + + // No methods or constants + + #endregion + + #region GL_ARB_texture_rectangle + + // Constants + public const uint GL_TEXTURE_RECTANGLE_ARB = 0x84F5; + public const uint GL_TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6; + public const uint GL_PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7; + public const uint GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8; + + #endregion + + #region GL_ARB_point_sprite + + // Constants + public const uint GL_POINT_SPRITE_ARB = 0x8861; + public const uint GL_COORD_REPLACE_ARB = 0x8862; + + #endregion + + #region GL_ARB_texture_float + + // Constants + public const uint GL_TEXTURE_RED_TYPE_ARB = 0x8C10; + public const uint GL_TEXTURE_GREEN_TYPE_ARB = 0x8C11; + public const uint GL_TEXTURE_BLUE_TYPE_ARB = 0x8C12; + public const uint GL_TEXTURE_ALPHA_TYPE_ARB = 0x8C13; + public const uint GL_TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14; + public const uint GL_TEXTURE_INTENSITY_TYPE_ARB = 0x8C15; + public const uint GL_TEXTURE_DEPTH_TYPE_ARB = 0x8C16; + public const uint GL_UNSIGNED_NORMALIZED_ARB = 0x8C17; + public const uint GL_RGBA32F_ARB = 0x8814; + public const uint GL_RGB32F_ARB = 0x8815; + public const uint GL_ALPHA32F_ARB = 0x8816; + public const uint GL_INTENSITY32F_ARB = 0x8817; + public const uint GL_LUMINANCE32F_ARB = 0x8818; + public const uint GL_LUMINANCE_ALPHA32F_ARB = 0x8819; + public const uint GL_RGBA16F_ARB = 0x881A; + public const uint GL_RGB16F_ARB = 0x881B; + public const uint GL_ALPHA16F_ARB = 0x881C; + public const uint GL_INTENSITY16F_ARB = 0x881D; + public const uint GL_LUMINANCE16F_ARB = 0x881E; + public const uint GL_LUMINANCE_ALPHA16F_ARB = 0x881F; + + #endregion + + #region GL_EXT_blend_equation_separate + + // Methods + public void BlendEquationSeparateEXT(uint modeRGB, uint modeAlpha) + { + // GetDelegateFor()(modeRGB, modeAlpha); + GetDelegateFor()(modeRGB); + } + + // Delegates + private delegate void glBlendEquationSeparateEXT(uint modeRGB, uint modeAlpha); + + // Constants + public const uint GL_BLEND_EQUATION_RGB_EXT = 0x8009; + public const uint GL_BLEND_EQUATION_ALPHA_EXT = 0x883D; + + #endregion + + #region GL_EXT_stencil_two_side + + // Methods + public void ActiveStencilFaceEXT(uint face) + { + GetDelegateFor()(face); + } + + // Delegates + private delegate void glActiveStencilFaceEXT(uint face); + + // Constants + public const uint GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8009; + public const uint GL_ACTIVE_STENCIL_FACE_EXT = 0x883D; + + #endregion + + #region GL_ARB_pixel_buffer_object + + public const uint GL_PIXEL_PACK_BUFFER_ARB = 0x88EB; + public const uint GL_PIXEL_UNPACK_BUFFER_ARB = 0x88EC; + public const uint GL_PIXEL_PACK_BUFFER_BINDING_ARB = 0x88ED; + public const uint GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = 0x88EF; + + #endregion + + #region GL_EXT_texture_sRGB + + public const uint GL_SRGB_EXT = 0x8C40; + public const uint GL_SRGB8_EXT = 0x8C41; + public const uint GL_SRGB_ALPHA_EXT = 0x8C42; + public const uint GL_SRGB8_ALPHA8_EXT = 0x8C43; + public const uint GL_SLUMINANCE_ALPHA_EXT = 0x8C44; + public const uint GL_SLUMINANCE8_ALPHA8_EXT = 0x8C45; + public const uint GL_SLUMINANCE_EXT = 0x8C46; + public const uint GL_SLUMINANCE8_EXT = 0x8C47; + public const uint GL_COMPRESSED_SRGB_EXT = 0x8C48; + public const uint GL_COMPRESSED_SRGB_ALPHA_EXT = 0x8C49; + public const uint GL_COMPRESSED_SLUMINANCE_EXT = 0x8C4A; + public const uint GL_COMPRESSED_SLUMINANCE_ALPHA_EXT = 0x8C4B; + public const uint GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; + public const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; + public const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; + public const uint GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; + + #endregion + + #region GL_EXT_framebuffer_object + + // Methods + public bool IsRenderbufferEXT(uint renderbuffer) + { + return (bool)GetDelegateFor()(renderbuffer); + } + + public void BindRenderbufferEXT(uint target, uint renderbuffer) + { + GetDelegateFor()(target, renderbuffer); + } + + public void DeleteRenderbuffersEXT(uint n, uint[] renderbuffers) + { + GetDelegateFor()(n, renderbuffers); + } + + public void GenRenderbuffersEXT(uint n, uint[] renderbuffers) + { + GetDelegateFor()(n, renderbuffers); + } + + public void RenderbufferStorageEXT(uint target, uint internalformat, int width, int height) + { + GetDelegateFor()(target, internalformat, width, height); + } + + public void GetRenderbufferParameterivEXT(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public bool IsFramebufferEXT(uint framebuffer) + { + return (bool)GetDelegateFor()(framebuffer); + } + + public void BindFramebufferEXT(uint target, uint framebuffer) + { + GetDelegateFor()(target, framebuffer); + } + + public void DeleteFramebuffersEXT(uint n, uint[] framebuffers) + { + GetDelegateFor()(n, framebuffers); + } + + public void GenFramebuffersEXT(uint n, uint[] framebuffers) + { + GetDelegateFor()(n, framebuffers); + } + + public uint CheckFramebufferStatusEXT(uint target) + { + return (uint)GetDelegateFor()(target); + } + + public void FramebufferTexture1DEXT(uint target, uint attachment, uint textarget, uint texture, int level) + { + GetDelegateFor()(target, attachment, textarget, texture, level); + } + + public void FramebufferTexture2DEXT(uint target, uint attachment, uint textarget, uint texture, int level) + { + GetDelegateFor()(target, attachment, textarget, texture, level); + } + + public void FramebufferTexture3DEXT(uint target, uint attachment, uint textarget, uint texture, int level, int zoffset) + { + GetDelegateFor()(target, attachment, textarget, texture, level, zoffset); + } + + public void FramebufferRenderbufferEXT(uint target, uint attachment, uint renderbuffertarget, uint renderbuffer) + { + GetDelegateFor()(target, attachment, renderbuffertarget, renderbuffer); + } + + public void GetFramebufferAttachmentParameterivEXT(uint target, uint attachment, uint pname, int[] parameters) + { + GetDelegateFor()(target, attachment, pname, parameters); + } + + public void GenerateMipmapEXT(uint target) + { + GetDelegateFor()(target); + } + + // Delegates + private delegate bool glIsRenderbufferEXT(uint renderbuffer); + private delegate void glBindRenderbufferEXT(uint target, uint renderbuffer); + private delegate void glDeleteRenderbuffersEXT(uint n, uint[] renderbuffers); + private delegate void glGenRenderbuffersEXT(uint n, uint[] renderbuffers); + private delegate void glRenderbufferStorageEXT(uint target, uint internalformat, int width, int height); + private delegate void glGetRenderbufferParameterivEXT(uint target, uint pname, int[] parameters); + private delegate bool glIsFramebufferEXT(uint framebuffer); + private delegate void glBindFramebufferEXT(uint target, uint framebuffer); + private delegate void glDeleteFramebuffersEXT(uint n, uint[] framebuffers); + private delegate void glGenFramebuffersEXT(uint n, uint[] framebuffers); + private delegate uint glCheckFramebufferStatusEXT(uint target); + private delegate void glFramebufferTexture1DEXT(uint target, uint attachment, uint textarget, uint texture, int level); + private delegate void glFramebufferTexture2DEXT(uint target, uint attachment, uint textarget, uint texture, int level); + private delegate void glFramebufferTexture3DEXT(uint target, uint attachment, uint textarget, uint texture, int level, int zoffset); + private delegate void glFramebufferRenderbufferEXT(uint target, uint attachment, uint renderbuffertarget, uint renderbuffer); + private delegate void glGetFramebufferAttachmentParameterivEXT(uint target, uint attachment, uint pname, int[] parameters); + private delegate void glGenerateMipmapEXT(uint target); + + // Constants + public const uint GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 0x0506; + public const uint GL_MAX_RENDERBUFFER_SIZE_EXT = 0x84E8; + public const uint GL_FRAMEBUFFER_BINDING_EXT = 0x8CA6; + public const uint GL_RENDERBUFFER_BINDING_EXT = 0x8CA7; + public const uint GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 0x8CD0; + public const uint GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 0x8CD1; + public const uint GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 0x8CD2; + public const uint GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 0x8CD3; + public const uint GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 0x8CD4; + public const uint GL_FRAMEBUFFER_COMPLETE_EXT = 0x8CD5; + public const uint GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 0x8CD6; + public const uint GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 0x8CD7; + public const uint GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 0x8CD9; + public const uint GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 0x8CDA; + public const uint GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 0x8CDB; + public const uint GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 0x8CDC; + public const uint GL_FRAMEBUFFER_UNSUPPORTED_EXT = 0x8CDD; + public const uint GL_MAX_COLOR_ATTACHMENTS_EXT = 0x8CDF; + public const uint GL_COLOR_ATTACHMENT0_EXT = 0x8CE0; + public const uint GL_COLOR_ATTACHMENT1_EXT = 0x8CE1; + public const uint GL_COLOR_ATTACHMENT2_EXT = 0x8CE2; + public const uint GL_COLOR_ATTACHMENT3_EXT = 0x8CE3; + public const uint GL_COLOR_ATTACHMENT4_EXT = 0x8CE4; + public const uint GL_COLOR_ATTACHMENT5_EXT = 0x8CE5; + public const uint GL_COLOR_ATTACHMENT6_EXT = 0x8CE6; + public const uint GL_COLOR_ATTACHMENT7_EXT = 0x8CE7; + public const uint GL_COLOR_ATTACHMENT8_EXT = 0x8CE8; + public const uint GL_COLOR_ATTACHMENT9_EXT = 0x8CE9; + public const uint GL_COLOR_ATTACHMENT10_EXT = 0x8CEA; + public const uint GL_COLOR_ATTACHMENT11_EXT = 0x8CEB; + public const uint GL_COLOR_ATTACHMENT12_EXT = 0x8CEC; + public const uint GL_COLOR_ATTACHMENT13_EXT = 0x8CED; + public const uint GL_COLOR_ATTACHMENT14_EXT = 0x8CEE; + public const uint GL_COLOR_ATTACHMENT15_EXT = 0x8CEF; + public const uint GL_DEPTH_ATTACHMENT_EXT = 0x8D00; + public const uint GL_STENCIL_ATTACHMENT_EXT = 0x8D20; + public const uint GL_FRAMEBUFFER_EXT = 0x8D40; + public const uint GL_RENDERBUFFER_EXT = 0x8D41; + public const uint GL_RENDERBUFFER_WIDTH_EXT = 0x8D42; + public const uint GL_RENDERBUFFER_HEIGHT_EXT = 0x8D43; + public const uint GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 0x8D44; + public const uint GL_STENCIL_INDEX1_EXT = 0x8D46; + public const uint GL_STENCIL_INDEX4_EXT = 0x8D47; + public const uint GL_STENCIL_INDEX8_EXT = 0x8D48; + public const uint GL_STENCIL_INDEX16_EXT = 0x8D49; + public const uint GL_RENDERBUFFER_RED_SIZE_EXT = 0x8D50; + public const uint GL_RENDERBUFFER_GREEN_SIZE_EXT = 0x8D51; + public const uint GL_RENDERBUFFER_BLUE_SIZE_EXT = 0x8D52; + public const uint GL_RENDERBUFFER_ALPHA_SIZE_EXT = 0x8D53; + public const uint GL_RENDERBUFFER_DEPTH_SIZE_EXT = 0x8D54; + public const uint GL_RENDERBUFFER_STENCIL_SIZE_EXT = 0x8D55; + + #endregion + + #region GL_EXT_framebuffer_multisample + + // Methods + public void RenderbufferStorageMultisampleEXT(uint target, int samples, uint internalformat, int width, int height) + { + GetDelegateFor()(target, samples, internalformat, width, height); + } + + // Delegates + private delegate void glRenderbufferStorageMultisampleEXT(uint target, int samples, uint internalformat, int width, int height); + + // Constants + public const uint GL_RENDERBUFFER_SAMPLES_EXT = 0x8CAB; + public const uint GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8D56; + public const uint GL_MAX_SAMPLES_EXT = 0x8D57; + + #endregion + + #region GL_EXT_draw_instanced + + // Methods + public void DrawArraysInstancedEXT(uint mode, int start, int count, int primcount) + { + GetDelegateFor()(mode, start, count, primcount); + } + public void DrawElementsInstancedEXT(uint mode, int count, uint type, IntPtr indices, int primcount) + { + GetDelegateFor()(mode, count, type, indices, primcount); + } + + // Delegates + private delegate void glDrawArraysInstancedEXT(uint mode, int start, int count, int primcount); + private delegate void glDrawElementsInstancedEXT(uint mode, int count, uint type, IntPtr indices, int primcount); + + #endregion + + #region GL_ARB_vertex_array_object + + // Methods + public void BindVertexArray(uint array) + { + GetDelegateFor()(array); + } + public void DeleteVertexArrays(int n, uint[] arrays) + { + GetDelegateFor()(n, arrays); + } + public void GenVertexArrays(int n, uint[] arrays) + { + GetDelegateFor()(n, arrays); + } + public bool IsVertexArray(uint array) + { + return (bool)GetDelegateFor()(array); + } + + // Delegates + private delegate void glBindVertexArray(uint array); + private delegate void glDeleteVertexArrays(int n, uint[] arrays); + private delegate void glGenVertexArrays(int n, uint[] arrays); + private delegate bool glIsVertexArray(uint array); + + // Constants + public const uint GL_VERTEX_ARRAY_BINDING = 0x85B5; + + #endregion + + #region GL_EXT_framebuffer_sRGB + + // Constants + public const uint GL_FRAMEBUFFER_SRGB_EXT = 0x8DB9; + public const uint GL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x8DBA; + + #endregion + + #region GGL_EXT_transform_feedback + + // Methods + public void BeginTransformFeedbackEXT(uint primitiveMode) + { + GetDelegateFor()(primitiveMode); + } + public void EndTransformFeedbackEXT() + { + GetDelegateFor()(); + } + public void BindBufferRangeEXT(uint target, uint index, uint buffer, int offset, int size) + { + GetDelegateFor()(target, index, buffer, offset, size); + } + public void BindBufferOffsetEXT(uint target, uint index, uint buffer, int offset) + { + GetDelegateFor()(target, index, buffer, offset); + } + public void BindBufferBaseEXT(uint target, uint index, uint buffer) + { + GetDelegateFor()(target, index, buffer); + } + public void TransformFeedbackVaryingsEXT(uint program, int count, string[] varyings, uint bufferMode) + { + GetDelegateFor()(program, count, varyings, bufferMode); + } + public void GetTransformFeedbackVaryingEXT(uint program, uint index, int bufSize, int[] length, int[] size, uint[] type, string name) + { + GetDelegateFor()(program, index, bufSize, length, size, type, name); + } + + // Delegates + private delegate void glBeginTransformFeedbackEXT(uint primitiveMode); + private delegate void glEndTransformFeedbackEXT (); + private delegate void glBindBufferRangeEXT (uint target, uint index, uint buffer, int offset, int size); + private delegate void glBindBufferOffsetEXT (uint target, uint index, uint buffer, int offset); + private delegate void glBindBufferBaseEXT (uint target, uint index, uint buffer); + private delegate void glTransformFeedbackVaryingsEXT (uint program, int count, string[] varyings, uint bufferMode); + private delegate void glGetTransformFeedbackVaryingEXT (uint program, uint index, int bufSize, int[] length, int[] size, uint[] type, string name); + + // Constants + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_EXT = 0x8C8E; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT = 0x8C84; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 0x8C85; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 0x8C8F; + public const uint GL_INTERLEAVED_ATTRIBS_EXT = 0x8C8C; + public const uint GL_SEPARATE_ATTRIBS_EXT = 0x8C8D; + public const uint GL_PRIMITIVES_GENERATED_EXT = 0x8C87; + public const uint GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 0x8C88; + public const uint GL_RASTERIZER_DISCARD_EXT = 0x8C89; + public const uint GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 0x8C8A; + public const uint GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 0x8C8B; + public const uint GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 0x8C80; + public const uint GL_TRANSFORM_FEEDBACK_VARYINGS_EXT = 0x8C83; + public const uint GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 0x8C7F; + public const uint GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 0x8C76; + + #endregion + + #region WGL_ARB_extensions_string + + /// + /// Gets the ARB extensions string. + /// + public string GetExtensionsStringARB() + { + return (string)GetDelegateFor()(RenderContextProvider.DeviceContextHandle); + } + + // Delegates + private delegate string wglGetExtensionsStringARB(IntPtr hdc); + + #endregion + + #region WGL_ARB_create_context + + // Methods + + /// + /// Creates a render context with the specified attributes. + /// + /// + /// If is not null, then all shareable data (excluding + /// OpenGL texture objects named 0) will be shared by , + /// all other contexts already shares with, and the + /// newly created context. An arbitrary number of contexts can share + /// data in this fashion. + /// + /// specifies a list of attributes for the context. The + /// list consists of a sequence of pairs terminated by the + /// value 0. If an attribute is not specified in , then the + /// default value specified below is used instead. If an attribute is + /// specified more than once, then the last value specified is used. + /// + public IntPtr CreateContextAttribsARB(IntPtr hShareContext, int[] attribList) + { + return (IntPtr)GetDelegateFor()(RenderContextProvider.DeviceContextHandle, hShareContext, attribList); + } + + // Delegates + private delegate IntPtr wglCreateContextAttribsARB(IntPtr hDC, IntPtr hShareContext, int[] attribList); + + // Constants + public const int WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; + public const int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; + public const int WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093; + public const int WGL_CONTEXT_FLAGS_ARB = 0x2094; + public const int WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; + public const int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001; + public const int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; + public const int WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; + public const int WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; + public const int ERROR_INVALID_VERSION_ARB = 0x2095; + public const int ERROR_INVALID_PROFILE_ARB = 0x2096; + + #endregion + + #region GL_ARB_explicit_uniform_location + + // Constants + + /// + /// The number of available pre-assigned uniform locations to that can default be + /// allocated in the default uniform block. + /// + public const int GL_MAX_UNIFORM_LOCATIONS = 0x826E; + + #endregion + + #region GL_ARB_clear_buffer_object + + /// + /// Fill a buffer object's data store with a fixed value + /// + /// Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER​, GL_ATOMIC_COUNTER_BUFFER​, GL_COPY_READ_BUFFER​, GL_COPY_WRITE_BUFFER​, GL_DRAW_INDIRECT_BUFFER​, GL_DISPATCH_INDIRECT_BUFFER​, GL_ELEMENT_ARRAY_BUFFER​, GL_PIXEL_PACK_BUFFER​, GL_PIXEL_UNPACK_BUFFER​, GL_QUERY_BUFFER​, GL_SHADER_STORAGE_BUFFER​, GL_TEXTURE_BUFFER​, GL_TRANSFORM_FEEDBACK_BUFFER​, or GL_UNIFORM_BUFFER​. + /// The sized internal format with which the data will be stored in the buffer object. + /// Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​. + /// Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​. + /// Specifies a pointer to a single pixel of data to upload. This parameter may not be NULL. + public void ClearBufferData(uint target, uint internalformat, uint format, uint type, IntPtr data) + { + GetDelegateFor()(target, internalformat, format, type, data); + } + + /// + /// Fill all or part of buffer object's data store with a fixed value + /// + /// Specifies the target buffer object. The symbolic constant must be GL_ARRAY_BUFFER​, GL_ATOMIC_COUNTER_BUFFER​, GL_COPY_READ_BUFFER​, GL_COPY_WRITE_BUFFER​, GL_DRAW_INDIRECT_BUFFER​, GL_DISPATCH_INDIRECT_BUFFER​, GL_ELEMENT_ARRAY_BUFFER​, GL_PIXEL_PACK_BUFFER​, GL_PIXEL_UNPACK_BUFFER​, GL_QUERY_BUFFER​, GL_SHADER_STORAGE_BUFFER​, GL_TEXTURE_BUFFER​, GL_TRANSFORM_FEEDBACK_BUFFER​, or GL_UNIFORM_BUFFER​. + /// The sized internal format with which the data will be stored in the buffer object. + /// The offset, in basic machine units into the buffer object's data store at which to start filling. + /// The size, in basic machine units of the range of the data store to fill. + /// Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​. + /// Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​. + /// Specifies a pointer to a single pixel of data to upload. This parameter may not be NULL. + public void ClearBufferSubData(uint target, uint internalformat, IntPtr offset, uint size, uint format, uint type, IntPtr data) + { + GetDelegateFor()(target, internalformat, offset, size, format, type, data); + } + + public void ClearNamedBufferDataEXT(uint buffer, uint internalformat, uint format, uint type, IntPtr data) + { + GetDelegateFor()(buffer, internalformat, format, type, data); + } + public void ClearNamedBufferSubDataEXT(uint buffer, uint internalformat, IntPtr offset, uint size, uint format, uint type, IntPtr data) + { + GetDelegateFor()(buffer, internalformat, offset, size, format, type, data); + } + + // Delegates + private delegate void glClearBufferData(uint target, uint internalformat, uint format, uint type, IntPtr data); + private delegate void glClearBufferSubData(uint target, uint internalformat, IntPtr offset, uint size, uint format, uint type, IntPtr data); + private delegate void glClearNamedBufferDataEXT(uint buffer, uint internalformat, uint format, uint type, IntPtr data); + private delegate void glClearNamedBufferSubDataEXT(uint buffer, uint internalformat, IntPtr offset, uint size, uint format, uint type, IntPtr data); + + #endregion + + #region GL_ARB_compute_shader + + /// + /// Launch one or more compute work groups + /// + /// The number of work groups to be launched in the X dimension. + /// The number of work groups to be launched in the Y dimension. + /// The number of work groups to be launched in the Z dimension. + public void DispatchCompute(uint num_groups_x, uint num_groups_y, uint num_groups_z) + { + GetDelegateFor()(num_groups_x, num_groups_y, num_groups_z); + } + + /// + /// Launch one or more compute work groups using parameters stored in a buffer + /// + /// The offset into the buffer object currently bound to the GL_DISPATCH_INDIRECT_BUFFER​ buffer target at which the dispatch parameters are stored. + public void DispatchComputeIndirect(IntPtr indirect) + { + GetDelegateFor()(indirect); + } + + // Delegates + private delegate void glDispatchCompute(uint num_groups_x, uint num_groups_y, uint num_groups_z); + private delegate void glDispatchComputeIndirect(IntPtr indirect); + + // Constants + public const uint GL_COMPUTE_SHADER = 0x91B9; + public const uint GL_MAX_COMPUTE_UNIFORM_BLOCKS = 0x91BB; + public const uint GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 0x91BC; + public const uint GL_MAX_COMPUTE_IMAGE_UNIFORMS = 0x91BD; + public const uint GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 0x8262; + public const uint GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 0x8263; + public const uint GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264; + public const uint GL_MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265; + public const uint GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266; + public const uint GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB; + public const uint GL_MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE; + public const uint GL_MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF; + public const uint GL_COMPUTE_WORK_GROUP_SIZE = 0x8267; + public const uint GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC; + public const uint GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED; + public const uint GL_DISPATCH_INDIRECT_BUFFER = 0x90EE; + public const uint GL_DISPATCH_INDIRECT_BUFFER_BINDING = 0x90EF; + public const uint GL_COMPUTE_SHADER_BIT = 0x00000020; + + #endregion + + #region GL_ARB_copy_image + + /// + /// Perform a raw data copy between two images + /// + /// The name of a texture or renderbuffer object from which to copy. + /// The target representing the namespace of the source name srcName​. + /// The mipmap level to read from the source. + /// The X coordinate of the left edge of the souce region to copy. + /// The Y coordinate of the top edge of the souce region to copy. + /// The Z coordinate of the near edge of the souce region to copy. + /// The name of a texture or renderbuffer object to which to copy. + /// The target representing the namespace of the destination name dstName​. + /// The desination mipmap level. + /// The X coordinate of the left edge of the destination region. + /// The Y coordinate of the top edge of the destination region. + /// The Z coordinate of the near edge of the destination region. + /// The width of the region to be copied. + /// The height of the region to be copied. + /// The depth of the region to be copied. + public void CopyImageSubData(uint srcName, uint srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, + uint dstTarget, int dstLevel, int dstX, int dstY, int dstZ, uint srcWidth, uint srcHeight, uint srcDepth) + { + GetDelegateFor()(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, + dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); + } + + // Delegates + private delegate void glCopyImageSubData(uint srcName, uint srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, + uint dstTarget, int dstLevel, int dstX, int dstY, int dstZ, uint srcWidth, uint srcHeight, uint srcDepth); + + #endregion + + #region GL_ARB_ES3_compatibility + + public const uint GL_COMPRESSED_RGB8_ETC2 = 0x9274; + public const uint GL_COMPRESSED_SRGB8_ETC2 = 0x9275; + public const uint GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; + public const uint GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; + public const uint GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; + public const uint GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; + public const uint GL_COMPRESSED_R11_EAC = 0x9270; + public const uint GL_COMPRESSED_SIGNED_R11_EAC = 0x9271; + public const uint GL_COMPRESSED_RG11_EAC = 0x9272; + public const uint GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; + public const uint GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; + public const uint GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + public const uint GL_MAX_ELEMENT_INDEX = 0x8D6B; + public const uint GL_TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + #endregion + + #region GL_ARB_framebuffer_no_attachments + + // Methods + + /// + /// Set a named parameter of a framebuffer. + /// + /// The target of the operation, which must be GL_READ_FRAMEBUFFER​, GL_DRAW_FRAMEBUFFER​ or GL_FRAMEBUFFER​. + /// A token indicating the parameter to be modified. + /// The new value for the parameter named pname​. + public void FramebufferParameter(uint target, uint pname, int param) + { + GetDelegateFor()(target, pname, param); + } + + /// + /// Retrieve a named parameter from a framebuffer + /// + /// The target of the operation, which must be GL_READ_FRAMEBUFFER​, GL_DRAW_FRAMEBUFFER​ or GL_FRAMEBUFFER​. + /// A token indicating the parameter to be retrieved. + /// The address of a variable to receive the value of the parameter named pname​. + public void GetFramebufferParameter(uint target, uint pname, int[] parameters) + { + GetDelegateFor()(target, pname, parameters); + } + + public void NamedFramebufferParameterEXT(uint framebuffer, uint pname, int param) + { + GetDelegateFor()(framebuffer, pname, param); + } + + public void GetNamedFramebufferParameterEXT(uint framebuffer, uint pname, int[] parameters) + { + GetDelegateFor()(framebuffer, pname, parameters); + } + + // Delegates + private delegate void glFramebufferParameteri(uint target, uint pname, int param); + private delegate void glGetFramebufferParameteriv(uint target, uint pname, int[] parameters); + private delegate void glNamedFramebufferParameteriEXT(uint framebuffer, uint pname, int param); + private delegate void glGetNamedFramebufferParameterivEXT(uint framebuffer, uint pname, int[] parameters); + + #endregion + + #region GL_ARB_internalformat_query2 + + /// + /// Retrieve information about implementation-dependent support for internal formats + /// + /// Indicates the usage of the internal format. target​ must be GL_TEXTURE_1D​, GL_TEXTURE_1D_ARRAY​, GL_TEXTURE_2D​, GL_TEXTURE_2D_ARRAY​, GL_TEXTURE_3D​, GL_TEXTURE_CUBE_MAP​, GL_TEXTURE_CUBE_MAP_ARRAY​, GL_TEXTURE_RECTANGLE​, GL_TEXTURE_BUFFER​, GL_RENDERBUFFER​, GL_TEXTURE_2D_MULTISAMPLE​ or GL_TEXTURE_2D_MULTISAMPLE_ARRAY​. + /// Specifies the internal format about which to retrieve information. + /// Specifies the type of information to query. + /// Specifies the maximum number of basic machine units that may be written to params​ by the function. + /// Specifies the address of a variable into which to write the retrieved information. + public void GetInternalformat(uint target, uint internalformat, uint pname, uint bufSize, int[] parameters) + { + GetDelegateFor()(target, internalformat, pname, bufSize, parameters); + } + + /// + /// Retrieve information about implementation-dependent support for internal formats + /// + /// Indicates the usage of the internal format. target​ must be GL_TEXTURE_1D​, GL_TEXTURE_1D_ARRAY​, GL_TEXTURE_2D​, GL_TEXTURE_2D_ARRAY​, GL_TEXTURE_3D​, GL_TEXTURE_CUBE_MAP​, GL_TEXTURE_CUBE_MAP_ARRAY​, GL_TEXTURE_RECTANGLE​, GL_TEXTURE_BUFFER​, GL_RENDERBUFFER​, GL_TEXTURE_2D_MULTISAMPLE​ or GL_TEXTURE_2D_MULTISAMPLE_ARRAY​. + /// Specifies the internal format about which to retrieve information. + /// Specifies the type of information to query. + /// Specifies the maximum number of basic machine units that may be written to params​ by the function. + /// Specifies the address of a variable into which to write the retrieved information. + public void GetInternalformat(uint target, uint internalformat, uint pname, uint bufSize, Int64[] parameters) + { + GetDelegateFor()(target, internalformat, pname, bufSize, parameters); + } + + // Delegates + private delegate void glGetInternalformativ(uint target, uint internalformat, uint pname, uint bufSize, int[] parameters); + private delegate void glGetInternalformati64v(uint target, uint internalformat, uint pname, uint bufSize, Int64[] parameters); + + // Constants + public const uint GL_RENDERBUFFER = 0x8D41; + public const uint GL_TEXTURE_2D_MULTISAMPLE = 0x9100; + public const uint GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102; + public const uint GL_NUM_SAMPLE_COUNTS = 0x9380; + public const uint GL_INTERNALFORMAT_SUPPORTED = 0x826F; + public const uint GL_INTERNALFORMAT_PREFERRED = 0x8270; + public const uint GL_INTERNALFORMAT_RED_SIZE = 0x8271; + public const uint GL_INTERNALFORMAT_GREEN_SIZE = 0x8272; + public const uint GL_INTERNALFORMAT_BLUE_SIZE = 0x8273; + public const uint GL_INTERNALFORMAT_ALPHA_SIZE = 0x8274; + public const uint GL_INTERNALFORMAT_DEPTH_SIZE = 0x8275; + public const uint GL_INTERNALFORMAT_STENCIL_SIZE = 0x8276; + public const uint GL_INTERNALFORMAT_SHARED_SIZE = 0x8277; + public const uint GL_INTERNALFORMAT_RED_TYPE = 0x8278; + public const uint GL_INTERNALFORMAT_GREEN_TYPE = 0x8279; + public const uint GL_INTERNALFORMAT_BLUE_TYPE = 0x827A; + public const uint GL_INTERNALFORMAT_ALPHA_TYPE = 0x827B; + public const uint GL_INTERNALFORMAT_DEPTH_TYPE = 0x827C; + public const uint GL_INTERNALFORMAT_STENCIL_TYPE = 0x827D; + public const uint GL_MAX_WIDTH = 0x827E; + public const uint GL_MAX_HEIGHT = 0x827F; + public const uint GL_MAX_DEPTH = 0x8280; + public const uint GL_MAX_LAYERS = 0x8281; + public const uint GL_MAX_COMBINED_DIMENSIONS = 0x8282; + public const uint GL_COLOR_COMPONENTS = 0x8283; + public const uint GL_DEPTH_COMPONENTS = 0x8284; + public const uint GL_STENCIL_COMPONENTS = 0x8285; + public const uint GL_COLOR_RENDERABLE = 0x8286; + public const uint GL_DEPTH_RENDERABLE = 0x8287; + public const uint GL_STENCIL_RENDERABLE = 0x8288; + public const uint GL_FRAMEBUFFER_RENDERABLE = 0x8289; + public const uint GL_FRAMEBUFFER_RENDERABLE_LAYERED = 0x828A; + public const uint GL_FRAMEBUFFER_BLEND = 0x828B; + public const uint GL_READ_PIXELS = 0x828C; + public const uint GL_READ_PIXELS_FORMAT = 0x828D; + public const uint GL_READ_PIXELS_TYPE = 0x828E; + public const uint GL_TEXTURE_IMAGE_FORMAT = 0x828F; + public const uint GL_TEXTURE_IMAGE_TYPE = 0x8290; + public const uint GL_GET_TEXTURE_IMAGE_FORMAT = 0x8291; + public const uint GL_GET_TEXTURE_IMAGE_TYPE = 0x8292; + public const uint GL_MIPMAP = 0x8293; + public const uint GL_MANUAL_GENERATE_MIPMAP = 0x8294; + public const uint GL_AUTO_GENERATE_MIPMAP = 0x8295; + public const uint GL_COLOR_ENCODING = 0x8296; + public const uint GL_SRGB_READ = 0x8297; + public const uint GL_SRGB_WRITE = 0x8298; + public const uint GL_SRGB_DECODE_ARB = 0x8299; + public const uint GL_FILTER = 0x829A; + public const uint GL_VERTEX_TEXTURE = 0x829B; + public const uint GL_TESS_CONTROL_TEXTURE = 0x829C; + public const uint GL_TESS_EVALUATION_TEXTURE = 0x829D; + public const uint GL_GEOMETRY_TEXTURE = 0x829E; + public const uint GL_FRAGMENT_TEXTURE = 0x829F; + public const uint GL_COMPUTE_TEXTURE = 0x82A0; + public const uint GL_TEXTURE_SHADOW = 0x82A1; + public const uint GL_TEXTURE_GATHER = 0x82A2; + public const uint GL_TEXTURE_GATHER_SHADOW = 0x82A3; + public const uint GL_SHADER_IMAGE_LOAD = 0x82A4; + public const uint GL_SHADER_IMAGE_STORE = 0x82A5; + public const uint GL_SHADER_IMAGE_ATOMIC = 0x82A6; + public const uint GL_IMAGE_TEXEL_SIZE = 0x82A7; + public const uint GL_IMAGE_COMPATIBILITY_CLASS = 0x82A8; + public const uint GL_IMAGE_PIXEL_FORMAT = 0x82A9; + public const uint GL_IMAGE_PIXEL_TYPE = 0x82AA; + public const uint GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7; + public const uint GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST = 0x82AC; + public const uint GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST = 0x82AD; + public const uint GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE = 0x82AE; + public const uint GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE = 0x82AF; + public const uint GL_TEXTURE_COMPRESSED_BLOCK_WIDTH = 0x82B1; + public const uint GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT = 0x82B2; + public const uint GL_TEXTURE_COMPRESSED_BLOCK_SIZE = 0x82B3; + public const uint GL_CLEAR_BUFFER = 0x82B4; + public const uint GL_TEXTURE_VIEW = 0x82B5; + public const uint GL_VIEW_COMPATIBILITY_CLASS = 0x82B6; + public const uint GL_FULL_SUPPORT = 0x82B7; + public const uint GL_CAVEAT_SUPPORT = 0x82B8; + public const uint GL_IMAGE_CLASS_4_X_32 = 0x82B9; + public const uint GL_IMAGE_CLASS_2_X_32 = 0x82BA; + public const uint GL_IMAGE_CLASS_1_X_32 = 0x82BB; + public const uint GL_IMAGE_CLASS_4_X_16 = 0x82BC; + public const uint GL_IMAGE_CLASS_2_X_16 = 0x82BD; + public const uint GL_IMAGE_CLASS_1_X_16 = 0x82BE; + public const uint GL_IMAGE_CLASS_4_X_8 = 0x82BF; + public const uint GL_IMAGE_CLASS_2_X_8 = 0x82C0; + public const uint GL_IMAGE_CLASS_1_X_8 = 0x82C1; + public const uint GL_IMAGE_CLASS_11_11_10 = 0x82C2; + public const uint GL_IMAGE_CLASS_10_10_10_2 = 0x82C3; + public const uint GL_VIEW_CLASS_128_BITS = 0x82C4; + public const uint GL_VIEW_CLASS_96_BITS = 0x82C5; + public const uint GL_VIEW_CLASS_64_BITS = 0x82C6; + public const uint GL_VIEW_CLASS_48_BITS = 0x82C7; + public const uint GL_VIEW_CLASS_32_BITS = 0x82C8; + public const uint GL_VIEW_CLASS_24_BITS = 0x82C9; + public const uint GL_VIEW_CLASS_16_BITS = 0x82CA; + public const uint GL_VIEW_CLASS_8_BITS = 0x82CB; + public const uint GL_VIEW_CLASS_S3TC_DXT1_RGB = 0x82CC; + public const uint GL_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD; + public const uint GL_VIEW_CLASS_S3TC_DXT3_RGBA = 0x82CE; + public const uint GL_VIEW_CLASS_S3TC_DXT5_RGBA = 0x82CF; + public const uint GL_VIEW_CLASS_RGTC1_RED = 0x82D0; + public const uint GL_VIEW_CLASS_RGTC2_RG = 0x82D1; + public const uint GL_VIEW_CLASS_BPTC_UNORM = 0x82D2; + public const uint GL_VIEW_CLASS_BPTC_FLOAT = 0x82D3; + + #endregion + + #region GL_ARB_invalidate_subdata + + /// + /// Invalidate a region of a texture image + /// + /// The name of a texture object a subregion of which to invalidate. + /// The level of detail of the texture object within which the region resides. + /// The X offset of the region to be invalidated. + /// The Y offset of the region to be invalidated. + /// The Z offset of the region to be invalidated. + /// The width of the region to be invalidated. + /// The height of the region to be invalidated. + /// The depth of the region to be invalidated. + public void InvalidateTexSubImage(uint texture, int level, int xoffset, int yoffset, int zoffset, + uint width, uint height, uint depth) + { + GetDelegateFor()(texture, level, xoffset, yoffset, zoffset, width, height, depth); + } + + /// + /// Invalidate the entirety a texture image + /// + /// The name of a texture object to invalidate. + /// The level of detail of the texture object to invalidate. + public void InvalidateTexImage(uint texture, int level) + { + GetDelegateFor()(texture, level); + } + + /// + /// Invalidate a region of a buffer object's data store + /// + /// The name of a buffer object, a subrange of whose data store to invalidate. + /// The offset within the buffer's data store of the start of the range to be invalidated. + /// The length of the range within the buffer's data store to be invalidated. + public void InvalidateBufferSubData(uint buffer, IntPtr offset, IntPtr length) + { + GetDelegateFor()(buffer, offset, length); + } + + /// + /// Invalidate the content of a buffer object's data store + /// + /// The name of a buffer object whose data store to invalidate. + public void InvalidateBufferData(uint buffer) + { + GetDelegateFor()(buffer); + } + + /// + /// Invalidate the content some or all of a framebuffer object's attachments + /// + /// The target to which the framebuffer is attached. target​ must be GL_FRAMEBUFFER​, GL_DRAW_FRAMEBUFFER​, or GL_READ_FRAMEBUFFER​. + /// The number of entries in the attachments​ array. + /// The address of an array identifying the attachments to be invalidated. + public void InvalidateFramebuffer(uint target, uint numAttachments, uint[] attachments) + { + GetDelegateFor()(target, numAttachments, attachments); + } + + /// + /// Invalidate the content of a region of some or all of a framebuffer object's attachments + /// + /// The target to which the framebuffer is attached. target​ must be GL_FRAMEBUFFER​, GL_DRAW_FRAMEBUFFER​, or GL_READ_FRAMEBUFFER​. + /// The number of entries in the attachments​ array. + /// The address of an array identifying the attachments to be invalidated. + /// The X offset of the region to be invalidated. + /// The Y offset of the region to be invalidated. + /// The width of the region to be invalidated. + /// The height of the region to be invalidated. + public void InvalidateSubFramebuffer(uint target, uint numAttachments, uint[] attachments, + int x, int y, uint width, uint height) + { + GetDelegateFor()(target, numAttachments, attachments, x, y, width, height); + } + + // Delegates + private delegate void glInvalidateTexSubImage(uint texture, int level, int xoffset, + int yoffset, int zoffset, uint width, uint height, uint depth); + private delegate void glInvalidateTexImage(uint texture, int level); + private delegate void glInvalidateBufferSubData(uint buffer, IntPtr offset, IntPtr length); + private delegate void glInvalidateBufferData(uint buffer); + private delegate void glInvalidateFramebuffer(uint target, uint numAttachments, uint[] attachments); + private delegate void glInvalidateSubFramebuffer(uint target, uint numAttachments, uint[] attachments, + int x, int y, uint width, uint height); + + #endregion + + #region ARB_multi_draw_indirect + + /// + /// Render multiple sets of primitives from array data, taking parameters from memory + /// + /// Specifies what kind of primitives to render. Symbolic constants GL_POINTS​, GL_LINE_STRIP​, GL_LINE_LOOP​, GL_LINES​, GL_LINE_STRIP_ADJACENCY​, GL_LINES_ADJACENCY​, GL_TRIANGLE_STRIP​, GL_TRIANGLE_FAN​, GL_TRIANGLES​, GL_TRIANGLE_STRIP_ADJACENCY​, GL_TRIANGLES_ADJACENCY​, and GL_PATCHES​ are accepted. + /// Specifies the address of an array of structures containing the draw parameters. + /// Specifies the the number of elements in the array of draw parameter structures. + /// Specifies the distance in basic machine units between elements of the draw parameter array. + public void MultiDrawArraysIndirect(uint mode, IntPtr indirect, uint primcount, uint stride) + { + GetDelegateFor()(mode, indirect, primcount, stride); + } + + /// + /// Render indexed primitives from array data, taking parameters from memory + /// + /// Specifies what kind of primitives to render. Symbolic constants GL_POINTS​, GL_LINE_STRIP​, GL_LINE_LOOP​, GL_LINES​, GL_LINE_STRIP_ADJACENCY​, GL_LINES_ADJACENCY​, GL_TRIANGLE_STRIP​, GL_TRIANGLE_FAN​, GL_TRIANGLES​, GL_TRIANGLE_STRIP_ADJACENCY​, GL_TRIANGLES_ADJACENCY​, and GL_PATCHES​ are accepted. + /// Specifies the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER​ binding. + /// Specifies a byte offset (cast to a pointer type) into the buffer bound to GL_DRAW_INDIRECT_BUFFER​, which designates the starting point of the structure containing the draw parameters. + /// Specifies the number of elements in the array addressed by indirect​. + /// Specifies the distance in basic machine units between elements of the draw parameter array. + public void MultiDrawElementsIndirect(uint mode, uint type, IntPtr indirect, uint primcount, uint stride) + { + GetDelegateFor()(mode, type, indirect, primcount, stride); + } + + private delegate void glMultiDrawArraysIndirect(uint mode, IntPtr indirect, uint primcount, uint stride); + private delegate void glMultiDrawElementsIndirect(uint mode, uint type, IntPtr indirect, uint primcount, uint stride); + + #endregion + + #region GL_ARB_program_interface_query + + /// + /// Query a property of an interface in a program + /// + /// The name of a program object whose interface to query. + /// A token identifying the interface within program​ to query. + /// The name of the parameter within programInterface​ to query. + /// The address of a variable to retrieve the value of pname​ for the program interface.. + public void GetProgramInterface(uint program, uint programInterface, uint pname, int[] parameters) + { + GetDelegateFor()(program, programInterface, pname, parameters); + } + + /// + /// Query the index of a named resource within a program + /// + /// The name of a program object whose resources to query. + /// A token identifying the interface within program​ containing the resource named name​. + /// The name of the resource to query the index of. + public void GetProgramResourceIndex(uint program, uint programInterface, string name) + { + GetDelegateFor()(program, programInterface, name); + } + + /// + /// Query the name of an indexed resource within a program + /// + /// The name of a program object whose resources to query. + /// A token identifying the interface within program​ containing the indexed resource. + /// The index of the resource within programInterface​ of program​. + /// The size of the character array whose address is given by name​. + /// The address of a variable which will receive the length of the resource name. + /// The address of a character array into which will be written the name of the resource. + public void GetProgramResourceName(uint program, uint programInterface, uint index, uint bufSize, out uint length, out string name) + { + var lengthParameter = new uint[1]; + var nameParameter = new string[1]; + GetDelegateFor()(program, programInterface, index, bufSize, lengthParameter, nameParameter); + length = lengthParameter[0]; + name = nameParameter[0]; + } + + /// + /// Retrieve values for multiple properties of a single active resource within a program object + /// + /// The name of a program object whose resources to query. + /// A token identifying the interface within program​ containing the resource named name​. + /// The index within the programInterface​ to query information about. + /// The number of properties being queried. + /// An array of properties of length propCount​ to query. + /// The number of GLint values in the params​ array. + /// If not NULL, then this value will be filled in with the number of actual parameters written to params​. + /// The output array of parameters to write. + public void GetProgramResource(uint program, uint programInterface, uint index, uint propCount, uint[] props, uint bufSize, out uint length, out int[] parameters) + { + var lengthParameter = new uint[1]; + var parametersParameter = new int[bufSize]; + + GetDelegateFor()(program, programInterface, index, propCount, props, bufSize, lengthParameter, parametersParameter); + length = lengthParameter[0]; + parameters = parametersParameter; + } + + /// + /// Query the location of a named resource within a program. + /// + /// The name of a program object whose resources to query. + /// A token identifying the interface within program​ containing the resource named name​. + /// The name of the resource to query the location of. + public void GetProgramResourceLocation(uint program, uint programInterface, string name) + { + GetDelegateFor()(program, programInterface, name); + } + + /// + /// Query the fragment color index of a named variable within a program. + /// + /// The name of a program object whose resources to query. + /// A token identifying the interface within program​ containing the resource named name​. + /// The name of the resource to query the location of. + public void GetProgramResourceLocationIndex(uint program, uint programInterface, string name) + { + GetDelegateFor()(program, programInterface, name); + } + + private delegate void glGetProgramInterfaceiv(uint program, uint programInterface, uint pname, int[] parameters); + private delegate uint glGetProgramResourceIndex(uint program, uint programInterface, string name); + private delegate void glGetProgramResourceName(uint program, uint programInterface, uint index, uint bufSize, uint[] length, string[] name); + private delegate void glGetProgramResourceiv(uint program, uint programInterface, uint index, uint propCount, uint[] props, uint bufSize, uint[] length, int[] parameters); + private delegate int glGetProgramResourceLocation(uint program, uint programInterface, string name); + private delegate int glGetProgramResourceLocationIndex(uint program, uint programInterface, string name); + + #endregion + + #region GL_ARB_shader_storage_buffer_object + + /// + /// Change an active shader storage block binding. + /// + /// The name of the program containing the block whose binding to change. + /// The index storage block within the program. + /// The index storage block binding to associate with the specified storage block. + public void ShaderStorageBlockBinding(uint program, uint storageBlockIndex, uint storageBlockBinding) + { + GetDelegateFor()(program, storageBlockIndex, storageBlockBinding); + } + + private delegate void glShaderStorageBlockBinding(uint program, uint storageBlockIndex, uint storageBlockBinding); + + // Constants + public const uint GL_SHADER_STORAGE_BUFFER = 0x90D2; + public const uint GL_SHADER_STORAGE_BUFFER_BINDING = 0x90D3; + public const uint GL_SHADER_STORAGE_BUFFER_START = 0x90D4; + public const uint GL_SHADER_STORAGE_BUFFER_SIZE = 0x90D5; + public const uint GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 0x90D6; + public const uint GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 0x90D7; + public const uint GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 0x90D8; + public const uint GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 0x90D9; + public const uint GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 0x90DA; + public const uint GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 0x90DB; + public const uint GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 0x90DC; + public const uint GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 0x90DD; + public const uint GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 0x90DE; + public const uint GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 0x90DF; + public const uint GL_SHADER_STORAGE_BARRIER_BIT = 0x2000; + public const uint GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 0x8F39; + + #endregion + + #region GL_ARB_stencil_texturing + + // Constants + public const uint GL_DEPTH_STENCIL_TEXTURE_MODE = 0x90EA; + + #endregion + + #region GL_ARB_texture_buffer_range + + /// + /// Bind a range of a buffer's data store to a buffer texture + /// + /// Specifies the target of the operation and must be GL_TEXTURE_BUFFER​. + /// Specifies the internal format of the data in the store belonging to buffer​. + /// Specifies the name of the buffer object whose storage to attach to the active buffer texture. + /// Specifies the offset of the start of the range of the buffer's data store to attach. + /// Specifies the size of the range of the buffer's data store to attach. + public void TexBufferRange(uint target, uint internalformat, uint buffer, IntPtr offset, IntPtr size) + { + GetDelegateFor()(target, internalformat, buffer, offset, size); + } + + /// + /// Bind a range of a buffer's data store to a buffer texture + /// + /// The texture. + /// Specifies the target of the operation and must be GL_TEXTURE_BUFFER​. + /// Specifies the internal format of the data in the store belonging to buffer​. + /// Specifies the name of the buffer object whose storage to attach to the active buffer texture. + /// Specifies the offset of the start of the range of the buffer's data store to attach. + /// Specifies the size of the range of the buffer's data store to attach. + public void TextureBufferRangeEXT(uint texture, uint target, uint internalformat, uint buffer, IntPtr offset, IntPtr size) + { + GetDelegateFor()(texture, target, internalformat, buffer, offset, size); + } + + private delegate void glTexBufferRange(uint target, uint internalformat, uint buffer, IntPtr offset, IntPtr size); + private delegate void glTextureBufferRangeEXT(uint texture, uint target, uint internalformat, uint buffer, IntPtr offset, IntPtr size); + + #endregion + + #region GL_ARB_texture_storage_multisample + + /// + /// Specify storage for a two-dimensional multisample texture. + /// + /// Specify the target of the operation. target​ must be GL_TEXTURE_2D_MULTISAMPLE​ or GL_PROXY_TEXTURE_2D_MULTISAMPLE​. + /// Specify the number of samples in the texture. + /// Specifies the sized internal format to be used to store texture image data. + /// Specifies the width of the texture, in texels. + /// Specifies the height of the texture, in texels. + /// Specifies whether the image will use identical sample locations and the same number of samples for all texels in the image, and the sample locations will not depend on the internal format or size of the image. + public void TexStorage2DMultisample(uint target, uint samples, uint internalformat, uint width, uint height, bool fixedsamplelocations) + { + GetDelegateFor()(target, samples, internalformat, width, height, fixedsamplelocations); + } + + /// + /// Specify storage for a three-dimensional multisample array texture + /// + /// Specify the target of the operation. target​ must be GL_TEXTURE_3D_MULTISAMPLE_ARRAY​ or GL_PROXY_TEXTURE_3D_MULTISAMPLE_ARRAY​. + /// Specify the number of samples in the texture. + /// Specifies the sized internal format to be used to store texture image data. + /// Specifies the width of the texture, in texels. + /// Specifies the height of the texture, in texels. + /// Specifies the depth of the texture, in layers. + /// Specifies the depth of the texture, in layers. + public void TexStorage3DMultisample(uint target, uint samples, uint internalformat, uint width, uint height, uint depth, bool fixedsamplelocations) + { + GetDelegateFor()(target, samples, internalformat, width, height, depth, fixedsamplelocations); + } + + /// + /// Specify storage for a two-dimensional multisample texture. + /// + /// The texture. + /// Specify the target of the operation. target​ must be GL_TEXTURE_2D_MULTISAMPLE​ or GL_PROXY_TEXTURE_2D_MULTISAMPLE​. + /// Specify the number of samples in the texture. + /// Specifies the sized internal format to be used to store texture image data. + /// Specifies the width of the texture, in texels. + /// Specifies the height of the texture, in texels. + /// Specifies whether the image will use identical sample locations and the same number of samples for all texels in the image, and the sample locations will not depend on the internal format or size of the image. + public void TexStorage2DMultisampleEXT(uint texture, uint target, uint samples, uint internalformat, uint width, uint height, bool fixedsamplelocations) + { + GetDelegateFor()(texture, target, samples, internalformat, width, height, fixedsamplelocations); + } + + /// + /// Specify storage for a three-dimensional multisample array texture + /// + /// The texture. + /// Specify the target of the operation. target​ must be GL_TEXTURE_3D_MULTISAMPLE_ARRAY​ or GL_PROXY_TEXTURE_3D_MULTISAMPLE_ARRAY​. + /// Specify the number of samples in the texture. + /// Specifies the sized internal format to be used to store texture image data. + /// Specifies the width of the texture, in texels. + /// Specifies the height of the texture, in texels. + /// Specifies the depth of the texture, in layers. + /// Specifies the depth of the texture, in layers. + public void TexStorage3DMultisampleEXT(uint texture, uint target, uint samples, uint internalformat, uint width, uint height, uint depth, bool fixedsamplelocations) + { + GetDelegateFor()(texture, target, samples, internalformat, width, height, depth, fixedsamplelocations); + } + + // Delegates + private delegate void glTexStorage2DMultisample(uint target, uint samples, uint internalformat, uint width, uint height, bool fixedsamplelocations); + private delegate void glTexStorage3DMultisample(uint target, uint samples, uint internalformat, uint width, uint height, uint depth, bool fixedsamplelocations); + private delegate void glTexStorage2DMultisampleEXT(uint texture, uint target, uint samples, uint internalformat, uint width, uint height, bool fixedsamplelocations); + private delegate void glTexStorage3DMultisampleEXT(uint texture, uint target, uint samples, uint internalformat, uint width, uint height, uint depth, bool fixedsamplelocations); + + #endregion + + #region GL_ARB_texture_view + + /// + /// Initialize a texture as a data alias of another texture's data store. + /// + /// Specifies the texture object to be initialized as a view. + /// Specifies the target to be used for the newly initialized texture. + /// Specifies the name of a texture object of which to make a view. + /// Specifies the internal format for the newly created view. + /// Specifies lowest level of detail of the view. + /// Specifies the number of levels of detail to include in the view. + /// Specifies the index of the first layer to include in the view. + /// Specifies the number of layers to include in the view. + public void TextureView(uint texture, uint target, uint origtexture, uint internalformat, uint minlevel, uint numlevels, uint minlayer, uint numlayers) + { + GetDelegateFor()(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); + } + + // Delegates + private delegate void glTextureView(uint texture, uint target, uint origtexture, uint internalformat, uint minlevel, uint numlevels, uint minlayer, uint numlayers); + + // Constants + public const uint GL_TEXTURE_VIEW_MIN_LEVEL = 0x82DB; + public const uint GL_TEXTURE_VIEW_NUM_LEVELS = 0x82DC; + public const uint GL_TEXTURE_VIEW_MIN_LAYER = 0x82DD; + public const uint GL_TEXTURE_VIEW_NUM_LAYERS = 0x82DE; + + #endregion + + #region GL_ARB_vertex_attrib_binding + + /// + /// Bind a buffer to a vertex buffer bind point. + /// + /// The index of the vertex buffer binding point to which to bind the buffer. + /// The name of an existing buffer to bind to the vertex buffer binding point. + /// The offset of the first element of the buffer. + /// The distance between elements within the buffer. + public void BindVertexBuffer(uint bindingindex, uint buffer, IntPtr offset, uint stride) + { + GetDelegateFor()(bindingindex, buffer, offset, stride); + } + + /// + /// Specify the organization of vertex arrays. + /// + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// GL_TRUE​ if the parameter represents a normalized integer (type​ must be an integer type). GL_FALSE​ otherwise. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexAttribFormat(uint attribindex, int size, uint type, bool normalized, uint relativeoffset) + { + GetDelegateFor()(attribindex, size, type, normalized, relativeoffset); + } + + /// + /// Specify the organization of vertex arrays. + /// + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexAttribIFormat(uint attribindex, int size, uint type, uint relativeoffset) + { + GetDelegateFor()(attribindex, size, type, relativeoffset); + } + + /// + /// Specify the organization of vertex arrays. + /// + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexAttribLFormat(uint attribindex, int size, uint type, uint relativeoffset) + { + GetDelegateFor()(attribindex, size, type, relativeoffset); + } + + /// + /// Associate a vertex attribute and a vertex buffer binding. + /// + /// The index of the attribute to associate with a vertex buffer binding. + /// The index of the vertex buffer binding with which to associate the generic vertex attribute. + public void VertexAttribBinding(uint attribindex, uint bindingindex) + { + GetDelegateFor()(attribindex, bindingindex); + } + + /// + /// Modify the rate at which generic vertex attributes advance. + /// + /// The index of the binding whose divisor to modify. + /// The new value for the instance step rate to apply. + public void VertexBindingDivisor(uint bindingindex, uint divisor) + { + GetDelegateFor()(bindingindex, divisor); + } + + /// + /// Bind a buffer to a vertex buffer bind point. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The index of the vertex buffer binding point to which to bind the buffer. + /// The name of an existing buffer to bind to the vertex buffer binding point. + /// The offset of the first element of the buffer. + /// The distance between elements within the buffer. + public void VertexArrayBindVertexBufferEXT(uint vaobj, uint bindingindex, uint buffer, IntPtr offset, uint stride) + { + GetDelegateFor()(vaobj, bindingindex, buffer, offset, stride); + } + + /// + /// Specify the organization of vertex arrays. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// GL_TRUE​ if the parameter represents a normalized integer (type​ must be an integer type). GL_FALSE​ otherwise. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexArrayVertexAttribFormatEXT(uint vaobj, uint attribindex, int size, uint type, bool normalized, uint relativeoffset) + { + GetDelegateFor()(vaobj, attribindex, size, type, normalized, relativeoffset); + } + + /// + /// Specify the organization of vertex arrays. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexArrayVertexAttribIFormatEXT(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset) + { + GetDelegateFor()(vaobj, attribindex, size, type, relativeoffset); + } + + /// + /// Specify the organization of vertex arrays. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The generic vertex attribute array being described. + /// The number of values per vertex that are stored in the array. + /// The type of the data stored in the array. + /// The offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from. + public void VertexArrayVertexAttribLFormatEXT(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset) + { + GetDelegateFor()(vaobj, attribindex, size, type, relativeoffset); + } + + /// + /// Associate a vertex attribute and a vertex buffer binding. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The index of the attribute to associate with a vertex buffer binding. + /// The index of the vertex buffer binding with which to associate the generic vertex attribute. + public void VertexArrayVertexAttribBindingEXT(uint vaobj, uint attribindex, uint bindingindex) + { + GetDelegateFor()(vaobj, attribindex, bindingindex); + } + + /// + /// Modify the rate at which generic vertex attributes advance. + /// Available only when When EXT_direct_state_access is present. + /// + /// The vertex array object. + /// The index of the binding whose divisor to modify. + /// The new value for the instance step rate to apply. + public void VertexArrayVertexBindingDivisorEXT(uint vaobj, uint bindingindex, uint divisor) + { + GetDelegateFor()(vaobj, bindingindex, divisor); + } + + // Delegates + private delegate void glBindVertexBuffer(uint bindingindex, uint buffer, IntPtr offset, uint stride); + private delegate void glVertexAttribFormat(uint attribindex, int size, uint type, bool normalized, uint relativeoffset); + private delegate void glVertexAttribIFormat(uint attribindex, int size, uint type, uint relativeoffset); + private delegate void glVertexAttribLFormat(uint attribindex, int size, uint type, uint relativeoffset); + private delegate void glVertexAttribBinding(uint attribindex, uint bindingindex); + private delegate void glVertexBindingDivisor(uint bindingindex, uint divisor); + private delegate void glVertexArrayBindVertexBufferEXT(uint vaobj, uint bindingindex, uint buffer, IntPtr offset, uint stride); + private delegate void glVertexArrayVertexAttribFormatEXT(uint vaobj, uint attribindex, int size, uint type, bool normalized, uint relativeoffset); + private delegate void glVertexArrayVertexAttribIFormatEXT(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset); + private delegate void glVertexArrayVertexAttribLFormatEXT(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset); + private delegate void glVertexArrayVertexAttribBindingEXT(uint vaobj, uint attribindex, uint bindingindex); + private delegate void glVertexArrayVertexBindingDivisorEXT(uint vaobj, uint bindingindex, uint divisor); + + // Constants + public const uint GL_VERTEX_ATTRIB_BINDING = 0x82D4; + public const uint GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D5; + public const uint GL_VERTEX_BINDING_DIVISOR = 0x82D6; + public const uint GL_VERTEX_BINDING_OFFSET = 0x82D7; + public const uint GL_VERTEX_BINDING_STRIDE = 0x82D8; + public const uint GL_VERTEX_BINDING_BUFFER = 0x8F4F; + public const uint GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D9; + public const uint GL_MAX_VERTEX_ATTRIB_BINDINGS = 0x82DA; + + #endregion + } +} diff --git a/src/SharpGL/RenderContextProviders/DIBSectionRenderContextProvider.cs b/src/SharpGL/RenderContextProviders/DIBSectionRenderContextProvider.cs new file mode 100644 index 0000000..de45c22 --- /dev/null +++ b/src/SharpGL/RenderContextProviders/DIBSectionRenderContextProvider.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + public class DIBSectionRenderContextProvider : RenderContextProvider + { + /// + /// Initializes a new instance of the class. + /// + public DIBSectionRenderContextProvider() + { + // We can layer GDI drawing on top of open gl drawing. + GDIDrawingEnabled = true; + } + + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The extra parameter. + /// + public override bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter) + { + // Call the base. + base.Create(openGLVersion, gl, width, height, bitDepth, parameter); + + // Get the desktop DC. + IntPtr desktopDC = Win32.GetDC(IntPtr.Zero); + + // Create our DC as a compatible DC for the desktop. + deviceContextHandle = Win32.CreateCompatibleDC(desktopDC); + + // Release the desktop DC. + Win32.ReleaseDC(IntPtr.Zero, desktopDC); + + // Create our dib section. + dibSection.Create(deviceContextHandle, width, height, bitDepth); + + // Create the render context. + Win32.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero); + renderContextHandle = Win32.wglCreateContext(deviceContextHandle); + + // Make current. + MakeCurrent(); + + // Update the context if required. + UpdateContextVersion(gl); + + // Return success. + return true; + } + + /// + /// Destroys the render context provider instance. + /// + public override void Destroy() + { + // Destroy the bitmap. + dibSection.Destroy(); + + // Release the device context. + Win32.ReleaseDC(IntPtr.Zero, deviceContextHandle); + + // Call the base, which will delete the render context handle. + base.Destroy(); + } + + public override void SetDimensions(int width, int height) + { + // Call the base. + base.SetDimensions(width, height); + + // Resize. + dibSection.Resize(width, height, BitDepth); + } + + public override void Blit(IntPtr hdc) + { + // We must have a device context. + // [RS] Why can the deviceContextHandle be zero? + if (deviceContextHandle == IntPtr.Zero) + return; + + // Swap the buffers. + Win32.SwapBuffers(deviceContextHandle); + + // Blit to the device context. + Win32.BitBlt(hdc, 0, 0, Width, Height, deviceContextHandle, 0, 0, Win32.SRCCOPY); + } + + public override void MakeCurrent() + { + // If we have a render context and DC make current. + if (renderContextHandle != IntPtr.Zero && deviceContextHandle != IntPtr.Zero) + Win32.wglMakeCurrent(deviceContextHandle, renderContextHandle); + } + + /// + /// The DIB Section object. + /// + protected DIBSection dibSection = new DIBSection(); + + /// + /// Gets the DIB section. + /// + /// The DIB section. + public DIBSection DIBSection + { + get { return dibSection; } + } + } +} diff --git a/src/SharpGL/RenderContextProviders/ExternalRenderContextProvider.cs b/src/SharpGL/RenderContextProviders/ExternalRenderContextProvider.cs new file mode 100644 index 0000000..6267dd8 --- /dev/null +++ b/src/SharpGL/RenderContextProviders/ExternalRenderContextProvider.cs @@ -0,0 +1,61 @@ +namespace SharpGL.RenderContextProviders +{ + using System; + + /// + /// Render context provider for working with an external render context + /// + public class ExternalRenderContextProvider : RenderContextProvider + { + /// + /// The window handle. + /// + protected IntPtr windowHandle = IntPtr.Zero; + + /// + /// Initializes a new instance of the class. + /// + /// The existing window handle. + /// The handle to the existing render context. + /// The handle to the existing device context. + public ExternalRenderContextProvider(IntPtr windowHandle, IntPtr renderContextHandle, IntPtr deviceContextHandle) + { + this.windowHandle = windowHandle; + this.deviceContextHandle = deviceContextHandle; + this.renderContextHandle = renderContextHandle; + } + + /// + /// Destroys the render context provider instance. + /// + public override void Destroy() + { + // Don't destroy the external context! + // base.Destroy(); + } + + /// + /// Blit the rendered data to the supplied device context. + /// + /// The HDC. + public override void Blit(IntPtr hdc) + { + // TODO: Should this do something in the case of an external context? + if (this.deviceContextHandle != IntPtr.Zero || this.windowHandle != IntPtr.Zero) + { + //Swap the buffers. + // Win32.SwapBuffers(deviceContextHandle); + } + } + + /// + /// Makes the render context current. + /// + public override void MakeCurrent() + { + // TODO: Should this have an effect with an external context? + // if (renderContextHandle != IntPtr.Zero) + // Win32.wglMakeCurrent(deviceContextHandle, renderContextHandle); + } + } +} \ No newline at end of file diff --git a/src/SharpGL/RenderContextProviders/FBORenderContextProvider.cs b/src/SharpGL/RenderContextProviders/FBORenderContextProvider.cs new file mode 100644 index 0000000..ff72d25 --- /dev/null +++ b/src/SharpGL/RenderContextProviders/FBORenderContextProvider.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + public class FBORenderContextProvider : HiddenWindowRenderContextProvider + { + /// + /// Initializes a new instance of the class. + /// + public FBORenderContextProvider() + { + // We can layer GDI drawing on top of open gl drawing. + GDIDrawingEnabled = true; + } + + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The parameter + /// + public override bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter) + { + this.gl = gl; + + // Call the base class. + base.Create(openGLVersion, gl, width, height, bitDepth, parameter); + + uint[] ids = new uint[1]; + + // First, create the frame buffer and bind it. + ids = new uint[1]; + gl.GenFramebuffersEXT(1, ids); + frameBufferID = ids[0]; + gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, frameBufferID); + + // Create the colour render buffer and bind it, then allocate storage for it. + gl.GenRenderbuffersEXT(1, ids); + colourRenderBufferID = ids[0]; + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, colourRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_RGBA, width, height); + + // Create the depth render buffer and bind it, then allocate storage for it. + gl.GenRenderbuffersEXT(1, ids); + depthRenderBufferID = ids[0]; + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, depthRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_DEPTH_COMPONENT24, width, height); + + // Set the render buffer for colour and depth. + gl.FramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, OpenGL.GL_COLOR_ATTACHMENT0_EXT, + OpenGL.GL_RENDERBUFFER_EXT, colourRenderBufferID); + gl.FramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, OpenGL.GL_DEPTH_ATTACHMENT_EXT, + OpenGL.GL_RENDERBUFFER_EXT, depthRenderBufferID); + + dibSectionDeviceContext = Win32.CreateCompatibleDC(deviceContextHandle); + + // Create the DIB section. + dibSection.Create(dibSectionDeviceContext, width, height, bitDepth); + + return true; + } + + private void DestroyFramebuffers() + { + // Delete the render buffers. + gl.DeleteRenderbuffersEXT(2, new uint[] { colourRenderBufferID, depthRenderBufferID }); + + // Delete the framebuffer. + gl.DeleteFramebuffersEXT(1, new uint[] { frameBufferID }); + + // Reset the IDs. + colourRenderBufferID = 0; + depthRenderBufferID = 0; + frameBufferID = 0; + } + + public override void Destroy() + { + // Delete the render buffers. + DestroyFramebuffers(); + + // Destroy the internal dc. + Win32.DeleteDC(dibSectionDeviceContext); + + // Call the base, which will delete the render context handle and window. + base.Destroy(); + } + + public override void SetDimensions(int width, int height) + { + // Call the base. + base.SetDimensions(width, height); + + // Resize dib section. + dibSection.Resize(width, height, BitDepth); + + DestroyFramebuffers(); + + // TODO: We should be able to just use the code below - however we + // get invalid dimension issues at the moment, so recreate for now. + + /* + // Resize the render buffer storage. + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, colourRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_RGBA, width, height); + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, depthRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_DEPTH_ATTACHMENT_EXT, width, height); + var complete = gl.CheckFramebufferStatusEXT(OpenGL.GL_FRAMEBUFFER_EXT); + */ + + uint[] ids = new uint[1]; + + // First, create the frame buffer and bind it. + ids = new uint[1]; + gl.GenFramebuffersEXT(1, ids); + frameBufferID = ids[0]; + gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, frameBufferID); + + // Create the colour render buffer and bind it, then allocate storage for it. + gl.GenRenderbuffersEXT(1, ids); + colourRenderBufferID = ids[0]; + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, colourRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_RGBA, width, height); + + // Create the depth render buffer and bind it, then allocate storage for it. + gl.GenRenderbuffersEXT(1, ids); + depthRenderBufferID = ids[0]; + gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, depthRenderBufferID); + gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_DEPTH_COMPONENT24, width, height); + + // Set the render buffer for colour and depth. + gl.FramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, OpenGL.GL_COLOR_ATTACHMENT0_EXT, + OpenGL.GL_RENDERBUFFER_EXT, colourRenderBufferID); + gl.FramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, OpenGL.GL_DEPTH_ATTACHMENT_EXT, + OpenGL.GL_RENDERBUFFER_EXT, depthRenderBufferID); + } + + public override void Blit(IntPtr hdc) + { + if (deviceContextHandle != IntPtr.Zero) + { + // Set the read buffer. + gl.ReadBuffer(OpenGL.GL_COLOR_ATTACHMENT0_EXT); + + // Read the pixels into the DIB section. + gl.ReadPixels(0, 0, Width, Height, OpenGL.GL_BGRA, + OpenGL.GL_UNSIGNED_BYTE, dibSection.Bits); + + // Blit the DC (containing the DIB section) to the target DC. + Win32.BitBlt(hdc, 0, 0, Width, Height, + dibSectionDeviceContext, 0, 0, Win32.SRCCOPY); + } + } + + protected uint colourRenderBufferID = 0; + protected uint depthRenderBufferID = 0; + protected uint frameBufferID = 0; + protected IntPtr dibSectionDeviceContext = IntPtr.Zero; + protected DIBSection dibSection = new DIBSection(); + protected OpenGL gl; + + /// + /// Gets the internal DIB section. + /// + /// The internal DIB section. + public DIBSection InternalDIBSection + { + get { return dibSection; } + } + } +} diff --git a/src/SharpGL/RenderContextProviders/HiddenWindowRenderContextProvider.cs b/src/SharpGL/RenderContextProviders/HiddenWindowRenderContextProvider.cs new file mode 100644 index 0000000..92324fb --- /dev/null +++ b/src/SharpGL/RenderContextProviders/HiddenWindowRenderContextProvider.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + public class HiddenWindowRenderContextProvider : RenderContextProvider + { + /// + /// Initializes a new instance of the class. + /// + public HiddenWindowRenderContextProvider() + { + // We can layer GDI drawing on top of open gl drawing. + GDIDrawingEnabled = true; + } + + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The parameter + /// + public override bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter) + { + // Call the base. + base.Create(openGLVersion, gl, width, height, bitDepth, parameter); + + // Create a new window class, as basic as possible. + Win32.WNDCLASSEX wndClass = new Win32.WNDCLASSEX(); + wndClass.Init(); + wndClass.style = Win32.ClassStyles.HorizontalRedraw | Win32.ClassStyles.VerticalRedraw | Win32.ClassStyles.OwnDC; + wndClass.lpfnWndProc = wndProcDelegate; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = 0; + wndClass.hInstance = IntPtr.Zero; + wndClass.hIcon = IntPtr.Zero; + wndClass.hCursor = IntPtr.Zero; + wndClass.hbrBackground = IntPtr.Zero; + wndClass.lpszMenuName = null; + wndClass.lpszClassName = "SharpGLRenderWindow"; + wndClass.hIconSm = IntPtr.Zero; + Win32.RegisterClassEx(ref wndClass); + + // Create the window. Position and size it. + windowHandle = Win32.CreateWindowEx(0, + "SharpGLRenderWindow", + "", + Win32.WindowStyles.WS_CLIPCHILDREN | Win32.WindowStyles.WS_CLIPSIBLINGS | Win32.WindowStyles.WS_POPUP, + 0, 0, width, height, + IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + + // Get the window device context. + deviceContextHandle = Win32.GetDC(windowHandle); + + // Setup a pixel format. + Win32.PIXELFORMATDESCRIPTOR pfd = new Win32.PIXELFORMATDESCRIPTOR(); + pfd.Init(); + pfd.nVersion = 1; + pfd.dwFlags = Win32.PFD_DRAW_TO_WINDOW | Win32.PFD_SUPPORT_OPENGL | Win32.PFD_DOUBLEBUFFER; + pfd.iPixelType = Win32.PFD_TYPE_RGBA; + pfd.cColorBits = (byte)bitDepth; + pfd.cDepthBits = 16; + pfd.cStencilBits = 8; + pfd.iLayerType = Win32.PFD_MAIN_PLANE; + + // Match an appropriate pixel format + int iPixelformat; + if((iPixelformat = Win32.ChoosePixelFormat(deviceContextHandle, pfd)) == 0 ) + return false; + + // Sets the pixel format + if (Win32.SetPixelFormat(deviceContextHandle, iPixelformat, pfd) == 0) + { + return false; + } + + // Create the render context. + renderContextHandle = Win32.wglCreateContext(deviceContextHandle); + + // Make the context current. + MakeCurrent(); + + // Update the context if required. + UpdateContextVersion(gl); + + // Return success. + return true; + } + + private static Win32.WndProc wndProcDelegate = new Win32.WndProc(WndProc); + + static private IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) + { + return Win32.DefWindowProc(hWnd, msg, wParam, lParam); + } + + /// + /// Destroys the render context provider instance. + /// + public override void Destroy() + { + // Release the device context. + Win32.ReleaseDC(windowHandle, deviceContextHandle); + + // Destroy the window. + Win32.DestroyWindow(windowHandle); + + // Call the base, which will delete the render context handle. + base.Destroy(); + } + + /// + /// Sets the dimensions of the render context provider. + /// + /// Width. + /// Height. + public override void SetDimensions(int width, int height) + { + // Call the base. + base.SetDimensions(width, height); + + // Set the window size. + Win32.SetWindowPos(windowHandle, IntPtr.Zero, 0, 0, Width, Height, + Win32.SetWindowPosFlags.SWP_NOACTIVATE | + Win32.SetWindowPosFlags.SWP_NOCOPYBITS | + Win32.SetWindowPosFlags.SWP_NOMOVE | + Win32.SetWindowPosFlags.SWP_NOOWNERZORDER); + } + + /// + /// Blit the rendered data to the supplied device context. + /// + /// The HDC. + public override void Blit(IntPtr hdc) + { + if(deviceContextHandle != IntPtr.Zero || windowHandle != IntPtr.Zero) + { + // Swap the buffers. + Win32.SwapBuffers(deviceContextHandle); + + // Get the HDC for the graphics object. + Win32.BitBlt(hdc, 0, 0, Width, Height, deviceContextHandle, 0, 0, Win32.SRCCOPY); + } + } + + /// + /// Makes the render context current. + /// + public override void MakeCurrent() + { + if(renderContextHandle != IntPtr.Zero) + Win32.wglMakeCurrent(deviceContextHandle, renderContextHandle); + } + + /// + /// The window handle. + /// + protected IntPtr windowHandle = IntPtr.Zero; + } +} diff --git a/src/SharpGL/RenderContextProviders/IRenderContextProvider.cs b/src/SharpGL/RenderContextProviders/IRenderContextProvider.cs new file mode 100644 index 0000000..d78cfbb --- /dev/null +++ b/src/SharpGL/RenderContextProviders/IRenderContextProvider.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + /// + /// Defines the contract for a type that can provide an OpenGL render context. + /// + public interface IRenderContextProvider : IDisposable + { + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The extra parameter. + /// + bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter); + + /// + /// Destroys the render context provider instance. + /// + void Destroy(); + + /// + /// Sets the dimensions of the render context provider. + /// + /// Width. + /// Height. + void SetDimensions(int width, int height); + + /// + /// Makes the render context current. + /// + void MakeCurrent(); + + /// + /// Blit the rendered data to the supplied device context. + /// + /// The HDC. + void Blit(IntPtr hdc); + + /// + /// Gets the render context handle. + /// + IntPtr RenderContextHandle + { + get; + } + + /// + /// Gets the device context handle. + /// + IntPtr DeviceContextHandle + { + get; + } + + /// + /// Gets or sets the width. + /// + /// The width. + int Width + { + get; + } + + /// + /// Gets or sets the height. + /// + /// The height. + int Height + { + get; + } + + /// + /// Gets or sets the bit depth. + /// + /// The bit depth. + int BitDepth + { + get; + } + + /// + /// Gets a value indicating whether GDI drawing is enabled for this type of render context. + /// + /// true if GDI drawing is enabled; otherwise, false. + bool GDIDrawingEnabled + { + get; + } + }; +} diff --git a/src/SharpGL/RenderContextProviders/NativeWindowRenderContextProvider.cs b/src/SharpGL/RenderContextProviders/NativeWindowRenderContextProvider.cs new file mode 100644 index 0000000..4ec92b5 --- /dev/null +++ b/src/SharpGL/RenderContextProviders/NativeWindowRenderContextProvider.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + public class NativeWindowRenderContextProvider : RenderContextProvider + { + /// + /// Initializes a new instance of the class. + /// + public NativeWindowRenderContextProvider() + { + // We cannot layer GDI drawing on top of open gl drawing. + GDIDrawingEnabled = false; + } + + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The parameter. + /// + /// A valid Window Handle must be provided for the NativeWindowRenderContextProvider + public override bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter) + { + // Call the base. + base.Create(openGLVersion, gl, width, height, bitDepth, parameter); + + // Cast the parameter to the device context. + try + { + windowHandle = (IntPtr)parameter; + } + catch + { + throw new Exception("A valid Window Handle must be provided for the NativeWindowRenderContextProvider"); + } + + // Get the window device context. + deviceContextHandle = Win32.GetDC(windowHandle); + + // Setup a pixel format. + Win32.PIXELFORMATDESCRIPTOR pfd = new Win32.PIXELFORMATDESCRIPTOR(); + pfd.Init(); + pfd.nVersion = 1; + pfd.dwFlags = Win32.PFD_DRAW_TO_WINDOW | Win32.PFD_SUPPORT_OPENGL | Win32.PFD_DOUBLEBUFFER; + pfd.iPixelType = Win32.PFD_TYPE_RGBA; + pfd.cColorBits = (byte)bitDepth; + pfd.cDepthBits = 16; + pfd.cStencilBits = 8; + pfd.iLayerType = Win32.PFD_MAIN_PLANE; + + // Match an appropriate pixel format + int iPixelformat; + if((iPixelformat = Win32.ChoosePixelFormat(deviceContextHandle, pfd)) == 0 ) + return false; + + // Sets the pixel format + if (Win32.SetPixelFormat(deviceContextHandle, iPixelformat, pfd) == 0) + { + return false; + } + + // Create the render context. + renderContextHandle = Win32.wglCreateContext(deviceContextHandle); + + // Make the context current. + MakeCurrent(); + + // Update the render context if required. + UpdateContextVersion(gl); + + // Return success. + return true; + } + + /// + /// Destroys the render context provider instance. + /// + public override void Destroy() + { + // Release the device context. + Win32.ReleaseDC(windowHandle, deviceContextHandle); + + // Call the base, which will delete the render context handle. + base.Destroy(); + } + + /// + /// Sets the dimensions of the render context provider. + /// + /// Width. + /// Height. + public override void SetDimensions(int width, int height) + { + // Call the base. + base.SetDimensions(width, height); + } + + /// + /// Blit the rendered data to the supplied device context. + /// + /// The HDC. + public override void Blit(IntPtr hdc) + { + if(deviceContextHandle != IntPtr.Zero || windowHandle != IntPtr.Zero) + { + // Swap the buffers. + Win32.SwapBuffers(deviceContextHandle); + } + } + + /// + /// Makes the render context current. + /// + public override void MakeCurrent() + { + if(renderContextHandle != IntPtr.Zero) + Win32.wglMakeCurrent(deviceContextHandle, renderContextHandle); + } + + /// + /// The window handle. + /// + protected IntPtr windowHandle = IntPtr.Zero; + } +} diff --git a/src/SharpGL/RenderContextProviders/RenderContextProvider.cs b/src/SharpGL/RenderContextProviders/RenderContextProvider.cs new file mode 100644 index 0000000..8e69b17 --- /dev/null +++ b/src/SharpGL/RenderContextProviders/RenderContextProvider.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SharpGL.Version; + +namespace SharpGL.RenderContextProviders +{ + public abstract class RenderContextProvider : IRenderContextProvider + { + /// + /// Creates the render context provider. Must also create the OpenGL extensions. + /// + /// The desired OpenGL version. + /// The OpenGL context. + /// The width. + /// The height. + /// The bit depth. + /// The extra parameter. + /// + public virtual bool Create(OpenGLVersion openGLVersion, OpenGL gl, int width, int height, int bitDepth, object parameter) + { + // Set the width, height and bit depth. + Width = width; + Height = height; + BitDepth = bitDepth; + + // For now, assume we're going to be able to create the requested OpenGL version. + requestedOpenGLVersion = openGLVersion; + createdOpenGLVersion = openGLVersion; + + return true; + } + + /// + /// Destroys the render context provider instance. + /// + public virtual void Destroy() + { + // If we have a render context, destroy it. + if(renderContextHandle != IntPtr.Zero) + { + Win32.wglDeleteContext(renderContextHandle); + renderContextHandle = IntPtr.Zero; + } + } + + /// + /// Sets the dimensions of the render context provider. + /// + /// Width. + /// Height. + public virtual void SetDimensions(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// Makes the render context current. + /// + public abstract void MakeCurrent(); + + /// + /// Blit the rendered data to the supplied device context. + /// + /// The HDC. + public abstract void Blit(IntPtr hdc); + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + void IDisposable.Dispose() + { + // Destroy the context provider. + Destroy(); + } + + /// + /// Only valid to be called after the render context is created, this function attempts to + /// move the render context to the OpenGL version originally requested. If this is > 2.1, this + /// means building a new context. If this fails, we'll have to make do with 2.1. + /// + /// The OpenGL instance. + protected void UpdateContextVersion(OpenGL gl) + { + // If the request version number is anything up to and including 2.1, standard render contexts + // will provide what we need (as long as the graphics card drivers are up to date). + var requestedVersionNumber = VersionAttribute.GetVersionAttribute(requestedOpenGLVersion); + if (requestedVersionNumber.IsAtLeastVersion(4, 4) == false) + { + createdOpenGLVersion = requestedOpenGLVersion; + return; + } + + // Now the none-trivial case. We must use the WGL_ARB_create_context extension to + // attempt to create a 3.0+ context. + try + { + int[] attributes = + { + OpenGL.WGL_CONTEXT_MAJOR_VERSION_ARB, requestedVersionNumber.Major, + OpenGL.WGL_CONTEXT_MINOR_VERSION_ARB, requestedVersionNumber.Minor, + OpenGL.WGL_CONTEXT_FLAGS_ARB, OpenGL.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + 0 + }; + var hrc = gl.CreateContextAttribsARB(IntPtr.Zero, attributes); + Win32.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero); + Win32.wglDeleteContext(renderContextHandle); + Win32.wglMakeCurrent(deviceContextHandle, hrc); + renderContextHandle = hrc; + } + catch(Exception) + { + // TODO: can we actually get the real version? + createdOpenGLVersion = OpenGLVersion.OpenGL2_1; + } + } + + /// + /// Gets the render context handle. + /// + public IntPtr RenderContextHandle + { + get { return renderContextHandle; } + protected set { renderContextHandle = value; } + } + + /// + /// Gets the device context handle. + /// + public IntPtr DeviceContextHandle + { + get { return deviceContextHandle; } + protected set { deviceContextHandle = value; } + } + + /// + /// Gets or sets the width. + /// + /// The width. + public int Width + { + get { return width; } + protected set { width = value; } + } + + /// + /// Gets or sets the height. + /// + /// The height. + public int Height + { + get { return height; } + protected set { height = value; } + } + + /// + /// Gets or sets the bit depth. + /// + /// The bit depth. + public int BitDepth + { + get { return bitDepth; } + protected set { bitDepth = value; } + } + + /// + /// Gets a value indicating whether GDI drawing is enabled for this type of render context. + /// + /// true if GDI drawing is enabled; otherwise, false. + public bool GDIDrawingEnabled + { + get { return gdiDrawingEnabled; } + protected set { gdiDrawingEnabled = value; } + } + + /// + /// Gets the OpenGL version that was requested when creating the render context. + /// + public OpenGLVersion RequestedOpenGLVersion + { + get { return requestedOpenGLVersion; } + } + + /// + /// Gets the OpenGL version that is supported by the render context, compare to . + /// + public OpenGLVersion CreatedOpenGLVersion + { + get { return createdOpenGLVersion; } + } + + /// + /// The render context handle. + /// + protected IntPtr renderContextHandle = IntPtr.Zero; + + /// + /// The device context handle. + /// + protected IntPtr deviceContextHandle = IntPtr.Zero; + + /// + /// The width. + /// + protected int width = 0; + + /// + /// The height. + /// + protected int height = 0; + + /// + /// The bit depth. + /// + protected int bitDepth = 0; + + /// + /// Is gdi drawing enabled? + /// + protected bool gdiDrawingEnabled = true; + + /// + /// The version of OpenGL that was requested when creating the render context. + /// + protected OpenGLVersion requestedOpenGLVersion; + + /// + /// The actual version of OpenGL that is supported by the render context. + /// + protected OpenGLVersion createdOpenGLVersion; + + } +} diff --git a/src/SharpGL/RenderContextType.cs b/src/SharpGL/RenderContextType.cs new file mode 100644 index 0000000..269fda8 --- /dev/null +++ b/src/SharpGL/RenderContextType.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL +{ + /// + /// The render context type. + /// + public enum RenderContextType + { + /// + /// A DIB section - offscreen but NEVER hardware accelerated. + /// + DIBSection, + + /// + /// A Native Window - directly render to a window, the window handle + /// must be passed as the parameter to Create. Hardware acceleration + /// is supported but one can never do GDI drawing on top of the + /// OpenGL drawing. + /// + NativeWindow, + + /// + /// A Hidden Window - more initial overhead but acceleratable. + /// + HiddenWindow, + + /// + /// A Framebuffer Object - accelerated but may not be supported on some cards. + /// + FBO + }; +} diff --git a/src/SharpGL/Shaders/Shader.cs b/src/SharpGL/Shaders/Shader.cs new file mode 100644 index 0000000..b371b95 --- /dev/null +++ b/src/SharpGL/Shaders/Shader.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.Shaders +{ + /// + /// This is the base class for all shaders (vertex and fragment). It offers functionality + /// which is core to all shaders, such as file loading and binding. + /// + public class Shader + { + public void Create(OpenGL gl, uint shaderType, string source) + { + // Create the OpenGL shader object. + shaderObject = gl.CreateShader(shaderType); + + // Set the shader source. + gl.ShaderSource(shaderObject, source); + + // Compile the shader object. + gl.CompileShader(shaderObject); + + // Now that we've compiled the shader, check it's compilation status. If it's not compiled properly, we're + // going to throw an exception. + if (GetCompileStatus(gl) == false) + { + throw new ShaderCompilationException(string.Format("Failed to compile shader with ID {0}.", shaderObject), GetInfoLog(gl)); + } + } + + public void Delete(OpenGL gl) + { + gl.DeleteShader(shaderObject); + shaderObject = 0; + } + + public bool GetCompileStatus(OpenGL gl) + { + int[] parameters = new int[] { 0 }; + gl.GetShader(shaderObject, OpenGL.GL_COMPILE_STATUS, parameters); + return parameters[0] == OpenGL.GL_TRUE; + } + + public string GetInfoLog(OpenGL gl) + { + // Get the info log length. + int[] infoLength = new int[] { 0 }; + gl.GetShader(ShaderObject, + OpenGL.GL_INFO_LOG_LENGTH, infoLength); + int bufSize = infoLength[0]; + + // Get the compile info. + StringBuilder il = new StringBuilder(bufSize); + gl.GetShaderInfoLog(shaderObject, bufSize, IntPtr.Zero, il); + + return il.ToString(); + } + + /// + /// The OpenGL shader object. + /// + private uint shaderObject; + + /// + /// Gets the shader object. + /// + public uint ShaderObject + { + get { return shaderObject; } + } + } + + +} diff --git a/src/SharpGL/Shaders/ShaderCompilationException.cs b/src/SharpGL/Shaders/ShaderCompilationException.cs new file mode 100644 index 0000000..0ee76f8 --- /dev/null +++ b/src/SharpGL/Shaders/ShaderCompilationException.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.Shaders +{ + [Serializable] + public class ShaderCompilationException : Exception + { + private readonly string compilerOutput; + + public ShaderCompilationException(string compilerOutput) + { + this.compilerOutput = compilerOutput; + } + public ShaderCompilationException(string message, string compilerOutput) + : base(message) + { + this.compilerOutput = compilerOutput; + } + public ShaderCompilationException(string message, Exception inner, string compilerOutput) + : base(message, inner) + { + this.compilerOutput = compilerOutput; + } + protected ShaderCompilationException( + System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) + : base(info, context) { } + + public string CompilerOutput { get { return compilerOutput; } } + } +} diff --git a/src/SharpGL/Shaders/ShaderProgram.cs b/src/SharpGL/Shaders/ShaderProgram.cs new file mode 100644 index 0000000..e25b171 --- /dev/null +++ b/src/SharpGL/Shaders/ShaderProgram.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.Shaders +{ + public class ShaderProgram + { + private readonly Shader vertexShader = new Shader(); + private readonly Shader fragmentShader = new Shader(); + + /// + /// Creates the shader program. + /// + /// The gl. + /// The vertex shader source. + /// The fragment shader source. + /// The attribute locations. This is an optional array of + /// uint attribute locations to their names. + /// + public void Create(OpenGL gl, string vertexShaderSource, string fragmentShaderSource, + Dictionary attributeLocations) + { + // Create the shaders. + vertexShader.Create(gl, OpenGL.GL_VERTEX_SHADER, vertexShaderSource); + fragmentShader.Create(gl, OpenGL.GL_FRAGMENT_SHADER, fragmentShaderSource); + + // Create the program, attach the shaders. + shaderProgramObject = gl.CreateProgram(); + gl.AttachShader(shaderProgramObject, vertexShader.ShaderObject); + gl.AttachShader(shaderProgramObject, fragmentShader.ShaderObject); + + // Before we link, bind any vertex attribute locations. + if (attributeLocations != null) + { + foreach (var vertexAttributeLocation in attributeLocations) + gl.BindAttribLocation(shaderProgramObject, vertexAttributeLocation.Key, vertexAttributeLocation.Value); + } + + // Now we can link the program. + gl.LinkProgram(shaderProgramObject); + + // Now that we've compiled and linked the shader, check it's link status. If it's not linked properly, we're + // going to throw an exception. + if (GetLinkStatus(gl) == false) + { + throw new ShaderCompilationException(string.Format("Failed to link shader program with ID {0}.", shaderProgramObject), GetInfoLog(gl)); + } + } + + public void Delete(OpenGL gl) + { + gl.DetachShader(shaderProgramObject, vertexShader.ShaderObject); + gl.DetachShader(shaderProgramObject, fragmentShader.ShaderObject); + vertexShader.Delete(gl); + fragmentShader.Delete(gl); + gl.DeleteProgram(shaderProgramObject); + shaderProgramObject = 0; + } + + public int GetAttributeLocation(OpenGL gl, string attributeName) + { + return gl.GetAttribLocation(shaderProgramObject, attributeName); + } + + public void BindAttributeLocation(OpenGL gl, uint location, string attribute) + { + gl.BindAttribLocation(shaderProgramObject, location, attribute); + } + + public void Bind(OpenGL gl) + { + gl.UseProgram(shaderProgramObject); + } + + public void Unbind(OpenGL gl) + { + gl.UseProgram(0); + } + + public bool GetLinkStatus(OpenGL gl) + { + int[] parameters = new int[] { 0 }; + gl.GetProgram(shaderProgramObject, OpenGL.GL_LINK_STATUS, parameters); + return parameters[0] == OpenGL.GL_TRUE; + } + + public string GetInfoLog(OpenGL gl) + { + // Get the info log length. + int[] infoLength = new int[] { 0 }; + gl.GetProgram(shaderProgramObject, OpenGL.GL_INFO_LOG_LENGTH, infoLength); + int bufSize = infoLength[0]; + + // Get the compile info. + StringBuilder il = new StringBuilder(bufSize); + gl.GetProgramInfoLog(shaderProgramObject, bufSize, IntPtr.Zero, il); + + return il.ToString(); + } + + public void AssertValid(OpenGL gl) + { + if (vertexShader.GetCompileStatus(gl) == false) + throw new Exception(vertexShader.GetInfoLog(gl)); + if (fragmentShader.GetCompileStatus(gl) == false) + throw new Exception(fragmentShader.GetInfoLog(gl)); + if (GetLinkStatus(gl) == false) + throw new Exception(GetInfoLog(gl)); + } + + public void SetUniform1(OpenGL gl, string uniformName, float v1) + { + gl.Uniform1(GetUniformLocation(gl, uniformName), v1); + } + + public void SetUniform3(OpenGL gl, string uniformName, float v1, float v2, float v3) + { + gl.Uniform3(GetUniformLocation(gl, uniformName), v1, v2, v3); + } + + public void SetUniformMatrix3(OpenGL gl, string uniformName, float[] m) + { + gl.UniformMatrix3(GetUniformLocation(gl, uniformName), 1, false, m); + } + + public void SetUniformMatrix4(OpenGL gl, string uniformName, float[] m) + { + gl.UniformMatrix4(GetUniformLocation(gl, uniformName), 1, false, m); + } + + public int GetUniformLocation(OpenGL gl, string uniformName) + { + // If we don't have the uniform name in the dictionary, get it's + // location and add it. + if (uniformNamesToLocations.ContainsKey(uniformName) == false) + { + uniformNamesToLocations[uniformName] = gl.GetUniformLocation(shaderProgramObject, uniformName); + // TODO: if it's not found, we should probably throw an exception. + } + + // Return the uniform location. + return uniformNamesToLocations[uniformName]; + } + + /// + /// Gets the shader program object. + /// + /// + /// The shader program object. + /// + public uint ShaderProgramObject + { + get { return shaderProgramObject; } + } + + private uint shaderProgramObject; + + /// + /// A mapping of uniform names to locations. This allows us to very easily specify + /// uniform data by name, quickly looking up the location first if needed. + /// + private readonly Dictionary uniformNamesToLocations = new Dictionary(); + } +} diff --git a/src/SharpGL/Tesselators/Delegates.cs b/src/SharpGL/Tesselators/Delegates.cs new file mode 100644 index 0000000..b471c21 --- /dev/null +++ b/src/SharpGL/Tesselators/Delegates.cs @@ -0,0 +1,89 @@ +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; +using System.Security; + +namespace SharpGL.Tesselators +{ + /// + /// Begins tesselation. + /// + /// The mode. + public delegate void Begin(uint mode); + + /// + /// Set the edge flag. + /// + /// if set to true [flag]. + public delegate void EdgeFlag(bool flag); + + /// + /// Vertex data. + /// + /// The data. + public delegate void Vertex(IntPtr data); + + /// + /// End tesselation. + /// + public delegate void End(); + + /// + /// Combine data. + /// + /// The coords. + /// The vertex data. + /// The weight. + /// The out data. + public delegate void Combine(double[] coords, IntPtr vertexData, float[] weight, double[] outData); + + /// + /// Error function. + /// + /// The error. + public delegate void Error(uint error); + + /// + /// Begin with user data. + /// + /// The mode. + /// The user data. + public delegate void BeginData(uint mode, IntPtr userData); + + /// + /// Edge flag with user data. + /// + /// if set to true [flag]. + /// The user data. + public delegate void EdgeFlagData(bool flag, IntPtr userData); + + /// + /// Vertex with user data. + /// + /// The data. + /// The user data. + public delegate void VertexData(IntPtr data, IntPtr userData); + + /// + /// End with data. + /// + /// The user data. + public delegate void EndData(IntPtr userData); + + /// + /// Combine with data. + /// + /// The coords. + /// The vertex data. + /// The weight. + /// The out data. + /// The user data. + public delegate void CombineData(double[] coords, IntPtr vertexData, float[] weight, double[] outData, IntPtr userData); + + /// + /// Error with data. + /// + /// The error. + /// The user data. + public delegate void ErrorData(uint error, IntPtr userData); +} \ No newline at end of file diff --git a/src/SharpGL/Version/OpenGLVersion.cs b/src/SharpGL/Version/OpenGLVersion.cs new file mode 100644 index 0000000..cca9dd2 --- /dev/null +++ b/src/SharpGL/Version/OpenGLVersion.cs @@ -0,0 +1,88 @@ +namespace SharpGL.Version +{ + /// + /// Used to specify explictly a version of OpenGL. + /// + public enum OpenGLVersion + { + /// + /// Version 1.1 + /// + [Version(1, 1)] OpenGL1_1, + + /// + /// Version 1.2 + /// + [Version(1, 2)] OpenGL1_2, + + /// + /// Version 1.3 + /// + [Version(1, 3)] OpenGL1_3, + + /// + /// Version 1.4 + /// + [Version(1, 4)] OpenGL1_4, + + /// + /// Version 1.5 + /// + [Version(1, 5)] OpenGL1_5, + + /// + /// OpenGL 2.0 + /// + [Version(2, 0)] OpenGL2_0, + + /// + /// OpenGL 2.1 + /// + [Version(2, 1)] OpenGL2_1, + + /// + /// OpenGL 3.0. This is the first version of OpenGL that requires a specially constructed render context. + /// + [Version(3, 0)] OpenGL3_0, + + /// + /// OpenGL 3.1 + /// + [Version(3, 1)] OpenGL3_1, + + /// + /// OpenGL 3.2 + /// + [Version(3, 2)] OpenGL3_2, + + /// + /// OpenGL 3.3 + /// + [Version(3, 3)] OpenGL3_3, + + /// + /// OpenGL 4.0 + /// + [Version(4, 0)] OpenGL4_0, + + /// + /// OpenGL 4.1 + /// + [Version(4, 1)] OpenGL4_1, + + /// + /// OpenGL 4.2 + /// + [Version(4, 2)] OpenGL4_2, + + /// + /// OpenGL 4.3 + /// + [Version(4, 3)] OpenGL4_3, + + /// + /// OpenGL 4.4 + /// + [Version(4, 4)] OpenGL4_4 + } +} \ No newline at end of file diff --git a/src/SharpGL/Version/VersionAttribute.cs b/src/SharpGL/Version/VersionAttribute.cs new file mode 100644 index 0000000..d1d0c94 --- /dev/null +++ b/src/SharpGL/Version/VersionAttribute.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.Version +{ + /// + /// Allows a version to be specified as metadata on a field. + /// + [AttributeUsage(AttributeTargets.Field)] + public class VersionAttribute : Attribute + { + private readonly int major; + private readonly int minor; + + /// + /// Initializes a new instance of the class. + /// + /// The major version number. + /// The minor version number. + public VersionAttribute(int major, int minor) + { + this.major = major; + this.minor = minor; + } + + /// + /// Determines whether this version is at least as high as the version specified in the parameters. + /// + /// The major version. + /// The minor version. + /// True if this version object is at least as high as the version specified by and . + public bool IsAtLeastVersion(int major, int minor) + { + // If major versions match, we care about minor. Otherwise, we only care about major. + if (this.major == major) + return this.major >= major && this.minor >= minor; + return this.major >= major; + } + + /// + /// Gets the version attribute of an enumeration value . + /// + /// The enumeration. + /// The defined on , or null of none exists. + public static VersionAttribute GetVersionAttribute(Enum enumeration) + { + // Get the attribute from the enumeration value (if it exists). + return enumeration + .GetType() + .GetMember(enumeration.ToString()) + .Single() + .GetCustomAttributes(typeof(VersionAttribute), false) + .OfType() + .FirstOrDefault(); + } + + /// + /// Gets the major version number. + /// + public int Major + { + get { return major; } + } + + /// + /// Gets the minor version number. + /// + public int Minor + { + get { return minor; } + } + } +} diff --git a/src/SharpGL/VertexBuffers/IndexBuffer.cs b/src/SharpGL/VertexBuffers/IndexBuffer.cs new file mode 100644 index 0000000..d255c86 --- /dev/null +++ b/src/SharpGL/VertexBuffers/IndexBuffer.cs @@ -0,0 +1,40 @@ +namespace SharpGL.VertexBuffers +{ + public class IndexBuffer + { + public void Create(OpenGL gl) + { + // Generate the vertex array. + uint[] ids = new uint[1]; + gl.GenBuffers(1, ids); + bufferObject = ids[0]; + } + + public void SetData(OpenGL gl, ushort[] rawData) + { + gl.BufferData(OpenGL.GL_ELEMENT_ARRAY_BUFFER, rawData, OpenGL.GL_STATIC_DRAW); + } + + public void Bind(OpenGL gl) + { + gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, bufferObject); + } + + public void Unbind(OpenGL gl) + { + gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, 0); + } + + public bool IsCreated() { return bufferObject != 0; } + + /// + /// Gets the index buffer object. + /// + public uint IndexBufferObject + { + get { return bufferObject; } + } + + private uint bufferObject; + } +} \ No newline at end of file diff --git a/src/SharpGL/VertexBuffers/VertexBuffer.cs b/src/SharpGL/VertexBuffers/VertexBuffer.cs new file mode 100644 index 0000000..e2f7f2d --- /dev/null +++ b/src/SharpGL/VertexBuffers/VertexBuffer.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.VertexBuffers +{ + /// + /// + /// + /// + /// Very useful reference for management of VBOs and VBAs: + /// http://stackoverflow.com/questions/8704801/glvertexattribpointer-clarification + /// + public class VertexBuffer + { + public void Create(OpenGL gl) + { + // Generate the vertex array. + uint[] ids = new uint[1]; + gl.GenBuffers(1, ids); + vertexBufferObject = ids[0]; + } + + public void SetData(OpenGL gl, uint attributeIndex, float[] rawData, bool isNormalised, int stride) + { + // Set the data, specify its shape and assign it to a vertex attribute (so shaders can bind to it). + gl.BufferData(OpenGL.GL_ARRAY_BUFFER, rawData, OpenGL.GL_STATIC_DRAW); + gl.VertexAttribPointer(attributeIndex, stride, OpenGL.GL_FLOAT, isNormalised, 0, IntPtr.Zero); + gl.EnableVertexAttribArray(attributeIndex); + } + + public void Bind(OpenGL gl) + { + gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, vertexBufferObject); + } + + public void Unbind(OpenGL gl) + { + gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0); + } + + public bool IsCreated() { return vertexBufferObject != 0; } + + /// + /// Gets the vertex buffer object. + /// + public uint VertexBufferObject + { + get { return vertexBufferObject; } + } + + private uint vertexBufferObject; + } +} diff --git a/src/SharpGL/VertexBuffers/VertexBufferArray.cs b/src/SharpGL/VertexBuffers/VertexBufferArray.cs new file mode 100644 index 0000000..779f3bc --- /dev/null +++ b/src/SharpGL/VertexBuffers/VertexBufferArray.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SharpGL.VertexBuffers +{ + /// + /// A VertexBufferArray is a logical grouping of VertexBuffers. Vertex Buffer Arrays + /// allow us to use a set of vertex buffers for vertices, indicies, normals and so on, + /// without having to use more complicated interleaved arrays. + /// + public class VertexBufferArray + { + public void Create(OpenGL gl) + { + // Generate the vertex array. + uint[] ids = new uint[1]; + gl.GenVertexArrays(1, ids); + vertexArrayObject = ids[0]; + } + + public void Delete(OpenGL gl) + { + gl.DeleteVertexArrays(1, new uint[] { vertexArrayObject }); + } + + public void Bind(OpenGL gl) + { + gl.BindVertexArray(vertexArrayObject); + } + + public void Unbind(OpenGL gl) + { + gl.BindVertexArray(0); + } + + /// + /// Gets the vertex buffer array object. + /// + public uint VertexBufferArrayObject + { + get { return vertexArrayObject; } + } + + private uint vertexArrayObject; + } +} diff --git a/src/SharpGL/Win32.cs b/src/SharpGL/Win32.cs new file mode 100644 index 0000000..97dc4f0 --- /dev/null +++ b/src/SharpGL/Win32.cs @@ -0,0 +1,910 @@ +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace SharpGL +{ + /// + /// Useful functions imported from the Win32 SDK. + /// + public static class Win32 + { + /// + /// Initializes the class. + /// + static Win32() + { + // Load the openGL library - without this wgl calls will fail. + IntPtr glLibrary = Win32.LoadLibrary(OpenGL32); + } + + // The names of the libraries we're importing. + public const string Kernel32 = "kernel32.dll"; + public const string OpenGL32 = "opengl32.dll"; + public const string Glu32 = "Glu32.dll"; + public const string Gdi32 = "gdi32.dll"; + public const string User32 = "user32.dll"; + + #region Kernel32 Functions + + [DllImport(Kernel32, SetLastError = true)] + public static extern IntPtr LoadLibrary(string lpFileName); + + #endregion + + #region WGL Functions + + /// + /// Gets the current render context. + /// + /// The current render context. + [DllImport(OpenGL32, SetLastError = true)] + public static extern IntPtr wglGetCurrentContext(); + + /// + /// Make the specified render context current. + /// + /// The handle to the device context. + /// The handle to the render context. + /// + [DllImport(OpenGL32, SetLastError = true)] + public static extern int wglMakeCurrent(IntPtr hdc, IntPtr hrc); + + /// + /// Creates a render context from the device context. + /// + /// The handle to the device context. + /// The handle to the render context. + [DllImport(OpenGL32, SetLastError = true)] + public static extern IntPtr wglCreateContext(IntPtr hdc); + + /// + /// Deletes the render context. + /// + /// The handle to the render context. + /// + [DllImport(OpenGL32, SetLastError = true)] + public static extern int wglDeleteContext(IntPtr hrc); + + /// + /// Gets a proc address. + /// + /// The name of the function. + /// The address of the function. + [DllImport(OpenGL32, SetLastError = true)] + public static extern IntPtr wglGetProcAddress(string name); + + /// + /// The wglUseFontBitmaps function creates a set of bitmap display lists for use in the current OpenGL rendering context. The set of bitmap display lists is based on the glyphs in the currently selected font in the device context. You can then use bitmaps to draw characters in an OpenGL image. + /// + /// Specifies the device context whose currently selected font will be used to form the glyph bitmap display lists in the current OpenGL rendering context.. + /// Specifies the first glyph in the run of glyphs that will be used to form glyph bitmap display lists. + /// Specifies the number of glyphs in the run of glyphs that will be used to form glyph bitmap display lists. The function creates count display lists, one for each glyph in the run. + /// Specifies a starting display list. + /// If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError. + [DllImport(OpenGL32, SetLastError = true)] + public static extern bool wglUseFontBitmaps(IntPtr hDC, uint first, uint count, uint listBase); + + /// + /// The wglUseFontOutlines function creates a set of display lists, one for each glyph of the currently selected outline font of a device context, for use with the current rendering context. + /// + /// The h DC. + /// The first. + /// The count. + /// The list base. + /// The deviation. + /// The extrusion. + /// The format. + /// The LPGMF. + /// + [DllImport(OpenGL32, SetLastError = true)] + public static extern bool wglUseFontOutlines(IntPtr hDC, uint first, uint count, uint listBase, + float deviation, float extrusion, int format, [Out, MarshalAs(UnmanagedType.LPArray)] GLYPHMETRICSFLOAT[] lpgmf); + + /// + /// Link two render contexts so they share lists (buffer IDs, etc.) + /// + /// The first context. + /// The second context. + /// If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. + /// To get extended error information, call GetLastError. + [DllImport(OpenGL32, SetLastError = true)] + public static extern bool wglShareLists(IntPtr hrc1, IntPtr hrc2); + + #endregion + + #region PixelFormatDescriptor structure and flags. + + [StructLayout(LayoutKind.Explicit)] + public class PIXELFORMATDESCRIPTOR + { + [FieldOffset(0)] + public UInt16 nSize; + [FieldOffset(2)] + public UInt16 nVersion; + [FieldOffset(4)] + public UInt32 dwFlags; + [FieldOffset(8)] + public Byte iPixelType; + [FieldOffset(9)] + public Byte cColorBits; + [FieldOffset(10)] + public Byte cRedBits; + [FieldOffset(11)] + public Byte cRedShift; + [FieldOffset(12)] + public Byte cGreenBits; + [FieldOffset(13)] + public Byte cGreenShift; + [FieldOffset(14)] + public Byte cBlueBits; + [FieldOffset(15)] + public Byte cBlueShift; + [FieldOffset(16)] + public Byte cAlphaBits; + [FieldOffset(17)] + public Byte cAlphaShift; + [FieldOffset(18)] + public Byte cAccumBits; + [FieldOffset(19)] + public Byte cAccumRedBits; + [FieldOffset(20)] + public Byte cAccumGreenBits; + [FieldOffset(21)] + public Byte cAccumBlueBits; + [FieldOffset(22)] + public Byte cAccumAlphaBits; + [FieldOffset(23)] + public Byte cDepthBits; + [FieldOffset(24)] + public Byte cStencilBits; + [FieldOffset(25)] + public Byte cAuxBuffers; + [FieldOffset(26)] + public SByte iLayerType; + [FieldOffset(27)] + public Byte bReserved; + [FieldOffset(28)] + public UInt32 dwLayerMask; + [FieldOffset(32)] + public UInt32 dwVisibleMask; + [FieldOffset(36)] + public UInt32 dwDamageMask; + + + public void Init() + { + nSize = (ushort)Marshal.SizeOf(this); + } + } + + public struct PixelFormatDescriptor + { + public ushort nSize; + public ushort nVersion; + public uint dwFlags; + public byte iPixelType; + public byte cColorBits; + public byte cRedBits; + public byte cRedShift; + public byte cGreenBits; + public byte cGreenShift; + public byte cBlueBits; + public byte cBlueShift; + public byte cAlphaBits; + public byte cAlphaShift; + public byte cAccumBits; + public byte cAccumRedBits; + public byte cAccumGreenBits; + public byte cAccumBlueBits; + public byte cAccumAlphaBits; + public byte cDepthBits; + public byte cStencilBits; + public byte cAuxBuffers; + public sbyte iLayerType; + public byte bReserved; + public uint dwLayerMask; + public uint dwVisibleMask; + public uint dwDamageMask; + } + + public const byte PFD_TYPE_RGBA = 0; + public const byte PFD_TYPE_COLORINDEX = 1; + + public const uint PFD_DOUBLEBUFFER = 1; + public const uint PFD_STEREO = 2; + public const uint PFD_DRAW_TO_WINDOW = 4; + public const uint PFD_DRAW_TO_BITMAP = 8; + public const uint PFD_SUPPORT_GDI = 16; + public const uint PFD_SUPPORT_OPENGL = 32; + public const uint PFD_GENERIC_FORMAT = 64; + public const uint PFD_NEED_PALETTE = 128; + public const uint PFD_NEED_SYSTEM_PALETTE = 256; + public const uint PFD_SWAP_EXCHANGE = 512; + public const uint PFD_SWAP_COPY = 1024; + public const uint PFD_SWAP_LAYER_BUFFERS = 2048; + public const uint PFD_GENERIC_ACCELERATED = 4096; + public const uint PFD_SUPPORT_DIRECTDRAW = 8192; + + public const sbyte PFD_MAIN_PLANE = 0; + public const sbyte PFD_OVERLAY_PLANE = 1; + public const sbyte PFD_UNDERLAY_PLANE = -1; + + public delegate IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); + + [DllImport(User32, SetLastError = true)] + public static extern IntPtr DefWindowProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam); + + [DllImport(User32, SetLastError = true)] + public static extern IntPtr CreateWindowEx( + WindowStylesEx dwExStyle, + string lpClassName, + string lpWindowName, + WindowStyles dwStyle, + int x, + int y, + int nWidth, + int nHeight, + IntPtr hWndParent, + IntPtr hMenu, + IntPtr hInstance, + IntPtr lpParam); + + [Flags] + public enum WindowStylesEx : uint + { + /// + /// Specifies that a window created with this style accepts drag-drop files. + /// + WS_EX_ACCEPTFILES = 0x00000010, + /// + /// Forces a top-level window onto the taskbar when the window is visible. + /// + WS_EX_APPWINDOW = 0x00040000, + /// + /// Specifies that a window has a border with a sunken edge. + /// + WS_EX_CLIENTEDGE = 0x00000200, + /// + /// Windows XP: Paints all descendants of a window in bottom-to-top painting order using double-buffering. For more information, see Remarks. This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC. + /// + WS_EX_COMPOSITED = 0x02000000, + /// + /// Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window. + /// WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles. + /// + WS_EX_CONTEXTHELP = 0x00000400, + /// + /// The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic. + /// + WS_EX_CONTROLPARENT = 0x00010000, + /// + /// Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter. + /// + WS_EX_DLGMODALFRAME = 0x00000001, + /// + /// Windows 2000/XP: Creates a layered window. Note that this cannot be used for child windows. Also, this cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC. + /// + WS_EX_LAYERED = 0x00080000, + /// + /// Arabic and Hebrew versions of Windows 98/Me, Windows 2000/XP: Creates a window whose horizontal origin is on the right edge. Increasing horizontal values advance to the left. + /// + WS_EX_LAYOUTRTL = 0x00400000, + /// + /// Creates a window that has generic left-aligned properties. This is the default. + /// + WS_EX_LEFT = 0x00000000, + /// + /// If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored. + /// + WS_EX_LEFTSCROLLBAR = 0x00004000, + /// + /// The window text is displayed using left-to-right reading-order properties. This is the default. + /// + WS_EX_LTRREADING = 0x00000000, + /// + /// Creates a multiple-document interface (MDI) child window. + /// + WS_EX_MDICHILD = 0x00000040, + /// + /// Windows 2000/XP: A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window. + /// To activate the window, use the SetActiveWindow or SetForegroundWindow function. + /// The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style. + /// + WS_EX_NOACTIVATE = 0x08000000, + /// + /// Windows 2000/XP: A window created with this style does not pass its window layout to its child windows. + /// + WS_EX_NOINHERITLAYOUT = 0x00100000, + /// + /// Specifies that a child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed. + /// + WS_EX_NOPARENTNOTIFY = 0x00000004, + /// + /// Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles. + /// + WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, + /// + /// Combines the WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW, and WS_EX_TOPMOST styles. + /// + WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + /// + /// The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored. + /// Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles. + /// + WS_EX_RIGHT = 0x00001000, + /// + /// Vertical scroll bar (if present) is to the right of the client area. This is the default. + /// + WS_EX_RIGHTSCROLLBAR = 0x00000000, + /// + /// If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text is displayed using right-to-left reading-order properties. For other languages, the style is ignored. + /// + WS_EX_RTLREADING = 0x00002000, + /// + /// Creates a window with a three-dimensional border style intended to be used for items that do not accept user input. + /// + WS_EX_STATICEDGE = 0x00020000, + /// + /// Creates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE. + /// + WS_EX_TOOLWINDOW = 0x00000080, + /// + /// Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function. + /// + WS_EX_TOPMOST = 0x00000008, + /// + /// Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted. + /// To achieve transparency without these restrictions, use the SetWindowRgn function. + /// + WS_EX_TRANSPARENT = 0x00000020, + /// + /// Specifies that a window has a border with a raised edge. + /// + WS_EX_WINDOWEDGE = 0x00000100 + } + + [Flags()] + public enum WindowStyles : uint + { + /// The window has a thin-line border. + WS_BORDER = 0x800000, + + /// The window has a title bar (includes the WS_BORDER style). + WS_CAPTION = 0xc00000, + + /// The window is a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style. + WS_CHILD = 0x40000000, + + /// Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window. + WS_CLIPCHILDREN = 0x2000000, + + /// + /// Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. + /// If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window. + /// + WS_CLIPSIBLINGS = 0x4000000, + + /// The window is initially disabled. A disabled window cannot receive input from the user. To change this after a window has been created, use the EnableWindow function. + WS_DISABLED = 0x8000000, + + /// The window has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar. + WS_DLGFRAME = 0x400000, + + /// + /// The window is the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. + /// The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys. + /// You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use the SetWindowLong function. + /// + WS_GROUP = 0x20000, + + /// The window has a horizontal scroll bar. + WS_HSCROLL = 0x100000, + + /// The window is initially maximized. + WS_MAXIMIZE = 0x1000000, + + /// The window has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. + WS_MAXIMIZEBOX = 0x10000, + + /// The window is initially minimized. + WS_MINIMIZE = 0x20000000, + + /// The window has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified. + WS_MINIMIZEBOX = 0x20000, + + /// The window is an overlapped window. An overlapped window has a title bar and a border. + WS_OVERLAPPED = 0x0, + + /// The window is an overlapped window. + WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_SIZEFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, + + /// The window is a pop-up window. This style cannot be used with the WS_CHILD style. + WS_POPUP = 0x80000000u, + + /// The window is a pop-up window. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible. + WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU, + + /// The window has a sizing border. + WS_SIZEFRAME = 0x40000, + + /// The window has a window menu on its title bar. The WS_CAPTION style must also be specified. + WS_SYSMENU = 0x80000, + + /// + /// The window is a control that can receive the keyboard focus when the user presses the TAB key. + /// Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style. + /// You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use the SetWindowLong function. + /// For user-created windows and modeless dialogs to work with tab stops, alter the message loop to call the IsDialogMessage function. + /// + WS_TABSTOP = 0x10000, + + /// The window is initially visible. This style can be turned on and off by using the ShowWindow or SetWindowPos function. + WS_VISIBLE = 0x10000000, + + /// The window has a vertical scroll bar. + WS_VSCROLL = 0x200000 + } + + + [Flags] + public enum ClassStyles : uint + { + ByteAlignClient = 0x1000, + ByteAlignWindow = 0x2000, + ClassDC = 0x40, + DoubleClicks = 0x8, + DropShadow = 0x20000, + GlobalClass = 0x4000, + HorizontalRedraw = 0x2, + NoClose = 0x200, + OwnDC = 0x20, + ParentDC = 0x80, + SaveBits = 0x800, + VerticalRedraw = 0x1 + } + + [StructLayout(LayoutKind.Sequential)] + public struct WNDCLASSEX + { + public uint cbSize; + public ClassStyles style; + [MarshalAs(UnmanagedType.FunctionPtr)] + public WndProc lpfnWndProc; + public int cbClsExtra; + public int cbWndExtra; + public IntPtr hInstance; + public IntPtr hIcon; + public IntPtr hCursor; + public IntPtr hbrBackground; + public string lpszMenuName; + public string lpszClassName; + public IntPtr hIconSm; + + public void Init() + { + cbSize = (uint)Marshal.SizeOf(this); + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct BITMAPINFO + { + public Int32 biSize; + public Int32 biWidth; + public Int32 biHeight; + public Int16 biPlanes; + public Int16 biBitCount; + public Int32 biCompression; + public Int32 biSizeImage; + public Int32 biXPelsPerMeter; + public Int32 biYPelsPerMeter; + public Int32 biClrUsed; + public Int32 biClrImportant; + + public void Init() + { + biSize = Marshal.SizeOf(this); + } + } + + #endregion + + #region Win32 Function Definitions. + + + + // Unmanaged functions from the Win32 graphics library. + [DllImport(Gdi32, SetLastError = true)] + public unsafe static extern int ChoosePixelFormat(IntPtr hDC, + [In, MarshalAs(UnmanagedType.LPStruct)] PIXELFORMATDESCRIPTOR ppfd); + + [DllImport(Gdi32, SetLastError = true)] + public unsafe static extern int SetPixelFormat(IntPtr hDC, int iPixelFormat, + [In, MarshalAs(UnmanagedType.LPStruct)] PIXELFORMATDESCRIPTOR ppfd ); + + [DllImport(Gdi32, SetLastError = true)] + public static extern IntPtr GetStockObject(uint fnObject); + + [DllImport(Gdi32, SetLastError = true)] + public static extern int SwapBuffers(IntPtr hDC); + + [DllImport(Gdi32, SetLastError = true)] + public static extern bool BitBlt(IntPtr hDC, int x, int y, int width, + int height, IntPtr hDCSource, int sourceX, int sourceY, uint type); + + [DllImport(Gdi32, SetLastError = true)] + public static extern IntPtr CreateDIBSection(IntPtr hdc, [In] ref BITMAPINFO pbmi, + uint pila, out IntPtr ppvBits, IntPtr hSection, uint dwOffset); + + [DllImport(Gdi32, SetLastError = true)] + public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj); + + [DllImport(Gdi32, SetLastError = true)] + public static extern bool DeleteObject(IntPtr hObject); + + [DllImport(Gdi32, SetLastError = true)] + public static extern IntPtr CreateCompatibleDC(IntPtr hDC); + + [DllImport(Gdi32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeleteDC(IntPtr hDC); + + [DllImport(Gdi32, SetLastError = true)] + public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, + int nOrientation, uint fnWeight, uint fdwItalic, uint fdwUnderline, uint + fdwStrikeOut, uint fdwCharSet, uint fdwOutputPrecision, uint + fdwClipPrecision, uint fdwQuality, uint fdwPitchAndFamily, string lpszFace); + + #endregion + + #region User32 Functions + + [DllImport(User32, SetLastError = true)] + public static extern IntPtr GetDC(IntPtr hWnd); + + [DllImport(User32, SetLastError = true)] + public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); + + [DllImport(User32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DestroyWindow(IntPtr hWnd); + + [DllImport(User32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags); + + [DllImport(User32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.U2)] + public static extern short RegisterClassEx([In] ref WNDCLASSEX lpwcx); + + #endregion + + [Flags] + public enum SetWindowPosFlags : uint + { + SWP_ASYNCWINDOWPOS = 0x4000, + SWP_DEFERERASE = 0x2000, + SWP_DRAWFRAME = 0x0020, + SWP_FRAMECHANGED = 0x0020, + SWP_HIDEWINDOW = 0x0080, + SWP_NOACTIVATE = 0x0010, + SWP_NOCOPYBITS = 0x0100, + SWP_NOMOVE = 0x0002, + SWP_NOOWNERZORDER = 0x0200, + SWP_NOREDRAW = 0x0008, + SWP_NOREPOSITION = 0x0200, + SWP_NOSENDCHANGING = 0x0400, + SWP_NOSIZE = 0x0001, + SWP_NOZORDER = 0x0004, + SWP_SHOWWINDOW = 0x0040, + } + + #region Windows Messages + + public const int WM_ACTIVATE = 0x0006; + public const int WM_ACTIVATEAPP = 0x001C; + public const int WM_AFXFIRST = 0x0360; + public const int WM_AFXLAST = 0x037F; + public const int WM_APP = 0x8000; + public const int WM_ASKCBFORMATNAME = 0x030C; + public const int WM_CANCELJOURNAL = 0x004B; + public const int WM_CANCELMODE = 0x001F; + public const int WM_CAPTURECHANGED = 0x0215; + public const int WM_CHANGECBCHAIN = 0x030D; + public const int WM_CHANGEUISTATE = 0x0127; + public const int WM_CHAR = 0x0102; + public const int WM_CHARTOITEM = 0x002F; + public const int WM_CHILDACTIVATE = 0x0022; + public const int WM_CLEAR = 0x0303; + public const int WM_CLOSE = 0x0010; + public const int WM_COMMAND = 0x0111; + public const int WM_COMPACTING = 0x0041; + public const int WM_COMPAREITEM = 0x0039; + public const int WM_CONTEXTMENU = 0x007B; + public const int WM_COPY = 0x0301; + public const int WM_COPYDATA = 0x004A; + public const int WM_CREATE = 0x0001; + public const int WM_CTLCOLORBTN = 0x0135; + public const int WM_CTLCOLORDLG = 0x0136; + public const int WM_CTLCOLOREDIT = 0x0133; + public const int WM_CTLCOLORLISTBOX = 0x0134; + public const int WM_CTLCOLORMSGBOX = 0x0132; + public const int WM_CTLCOLORSCROLLBAR = 0x0137; + public const int WM_CTLCOLORSTATIC = 0x0138; + public const int WM_CUT = 0x0300; + public const int WM_DEADCHAR = 0x0103; + public const int WM_DELETEITEM = 0x002D; + public const int WM_DESTROY = 0x0002; + public const int WM_DESTROYCLIPBOARD = 0x0307; + public const int WM_DEVICECHANGE = 0x0219; + public const int WM_DEVMODECHANGE = 0x001B; + public const int WM_DISPLAYCHANGE = 0x007E; + public const int WM_DRAWCLIPBOARD = 0x0308; + public const int WM_DRAWITEM = 0x002B; + public const int WM_DROPFILES = 0x0233; + public const int WM_ENABLE = 0x000A; + public const int WM_ENDSESSION = 0x0016; + public const int WM_ENTERIDLE = 0x0121; + public const int WM_ENTERMENULOOP = 0x0211; + public const int WM_ENTERSIZEMOVE = 0x0231; + public const int WM_ERASEBKGND = 0x0014; + public const int WM_EXITMENULOOP = 0x0212; + public const int WM_EXITSIZEMOVE = 0x0232; + public const int WM_FONTCHANGE = 0x001D; + public const int WM_GETDLGCODE = 0x0087; + public const int WM_GETFONT = 0x0031; + public const int WM_GETHOTKEY = 0x0033; + public const int WM_GETICON = 0x007F; + public const int WM_GETMINMAXINFO = 0x0024; + public const int WM_GETOBJECT = 0x003D; + public const int WM_GETTEXT = 0x000D; + public const int WM_GETTEXTLENGTH = 0x000E; + public const int WM_HANDHELDFIRST = 0x0358; + public const int WM_HANDHELDLAST = 0x035F; + public const int WM_HELP = 0x0053; + public const int WM_HOTKEY = 0x0312; + public const int WM_HSCROLL = 0x0114; + public const int WM_HSCROLLCLIPBOARD = 0x030E; + public const int WM_ICONERASEBKGND = 0x0027; + public const int WM_IME_CHAR = 0x0286; + public const int WM_IME_COMPOSITION = 0x010F; + public const int WM_IME_COMPOSITIONFULL = 0x0284; + public const int WM_IME_CONTROL = 0x0283; + public const int WM_IME_ENDCOMPOSITION = 0x010E; + public const int WM_IME_KEYDOWN = 0x0290; + public const int WM_IME_KEYLAST = 0x010F; + public const int WM_IME_KEYUP = 0x0291; + public const int WM_IME_NOTIFY = 0x0282; + public const int WM_IME_REQUEST = 0x0288; + public const int WM_IME_SELECT = 0x0285; + public const int WM_IME_SETCONTEXT = 0x0281; + public const int WM_IME_STARTCOMPOSITION = 0x010D; + public const int WM_INITDIALOG = 0x0110; + public const int WM_INITMENU = 0x0116; + public const int WM_INITMENUPOPUP = 0x0117; + public const int WM_INPUTLANGCHANGE = 0x0051; + public const int WM_INPUTLANGCHANGEREQUEST = 0x0050; + public const int WM_KEYDOWN = 0x0100; + public const int WM_KEYFIRST = 0x0100; + public const int WM_KEYLAST = 0x0108; + public const int WM_KEYUP = 0x0101; + public const int WM_KILLFOCUS = 0x0008; + public const int WM_LBUTTONDBLCLK = 0x0203; + public const int WM_LBUTTONDOWN = 0x0201; + public const int WM_LBUTTONUP = 0x0202; + public const int WM_MBUTTONDBLCLK = 0x0209; + public const int WM_MBUTTONDOWN = 0x0207; + public const int WM_MBUTTONUP = 0x0208; + public const int WM_MDIACTIVATE = 0x0222; + public const int WM_MDICASCADE = 0x0227; + public const int WM_MDICREATE = 0x0220; + public const int WM_MDIDESTROY = 0x0221; + public const int WM_MDIGETACTIVE = 0x0229; + public const int WM_MDIICONARRANGE = 0x0228; + public const int WM_MDIMAXIMIZE = 0x0225; + public const int WM_MDINEXT = 0x0224; + public const int WM_MDIREFRESHMENU = 0x0234; + public const int WM_MDIRESTORE = 0x0223; + public const int WM_MDISETMENU = 0x0230; + public const int WM_MDITILE = 0x0226; + public const int WM_MEASUREITEM = 0x002C; + public const int WM_MENUCHAR = 0x0120; + public const int WM_MENUCOMMAND = 0x0126; + public const int WM_MENUDRAG = 0x0123; + public const int WM_MENUGETOBJECT = 0x0124; + public const int WM_MENURBUTTONUP = 0x0122; + public const int WM_MENUSELECT = 0x011F; + public const int WM_MOUSEACTIVATE = 0x0021; + public const int WM_MOUSEFIRST = 0x0200; + public const int WM_MOUSEHOVER = 0x02A1; + public const int WM_MOUSELAST = 0x020D; + public const int WM_MOUSELEAVE = 0x02A3; + public const int WM_MOUSEMOVE = 0x0200; + public const int WM_MOUSEWHEEL = 0x020A; + public const int WM_MOUSEHWHEEL = 0x020E; + public const int WM_MOVE = 0x0003; + public const int WM_MOVING = 0x0216; + public const int WM_NCACTIVATE = 0x0086; + public const int WM_NCCALCSIZE = 0x0083; + public const int WM_NCCREATE = 0x0081; + public const int WM_NCDESTROY = 0x0082; + public const int WM_NCHITTEST = 0x0084; + public const int WM_NCLBUTTONDBLCLK = 0x00A3; + public const int WM_NCLBUTTONDOWN = 0x00A1; + public const int WM_NCLBUTTONUP = 0x00A2; + public const int WM_NCMBUTTONDBLCLK = 0x00A9; + public const int WM_NCMBUTTONDOWN = 0x00A7; + public const int WM_NCMBUTTONUP = 0x00A8; + public const int WM_NCMOUSEMOVE = 0x00A0; + public const int WM_NCPAINT = 0x0085; + public const int WM_NCRBUTTONDBLCLK = 0x00A6; + public const int WM_NCRBUTTONDOWN = 0x00A4; + public const int WM_NCRBUTTONUP = 0x00A5; + public const int WM_NEXTDLGCTL = 0x0028; + public const int WM_NEXTMENU = 0x0213; + public const int WM_NOTIFY = 0x004E; + public const int WM_NOTIFYFORMAT = 0x0055; + public const int WM_NULL = 0x0000; + public const int WM_PAINT = 0x000F; + public const int WM_PAINTCLIPBOARD = 0x0309; + public const int WM_PAINTICON = 0x0026; + public const int WM_PALETTECHANGED = 0x0311; + public const int WM_PALETTEISCHANGING = 0x0310; + public const int WM_PARENTNOTIFY = 0x0210; + public const int WM_PASTE = 0x0302; + public const int WM_PENWINFIRST = 0x0380; + public const int WM_PENWINLAST = 0x038F; + public const int WM_POWER = 0x0048; + public const int WM_POWERBROADCAST = 0x0218; + public const int WM_PRINT = 0x0317; + public const int WM_PRINTCLIENT = 0x0318; + public const int WM_QUERYDRAGICON = 0x0037; + public const int WM_QUERYENDSESSION = 0x0011; + public const int WM_QUERYNEWPALETTE = 0x030F; + public const int WM_QUERYOPEN = 0x0013; + public const int WM_QUEUESYNC = 0x0023; + public const int WM_QUIT = 0x0012; + public const int WM_RBUTTONDBLCLK = 0x0206; + public const int WM_RBUTTONDOWN = 0x0204; + public const int WM_RBUTTONUP = 0x0205; + public const int WM_RENDERALLFORMATS = 0x0306; + public const int WM_RENDERFORMAT = 0x0305; + public const int WM_SETCURSOR = 0x0020; + public const int WM_SETFOCUS = 0x0007; + public const int WM_SETFONT = 0x0030; + public const int WM_SETHOTKEY = 0x0032; + public const int WM_SETICON = 0x0080; + public const int WM_SETREDRAW = 0x000B; + public const int WM_SETTEXT = 0x000C; + public const int WM_SETTINGCHANGE = 0x001A; + public const int WM_SHOWWINDOW = 0x0018; + public const int WM_SIZE = 0x0005; + public const int WM_SIZECLIPBOARD = 0x030B; + public const int WM_SIZING = 0x0214; + public const int WM_SPOOLERSTATUS = 0x002A; + public const int WM_STYLECHANGED = 0x007D; + public const int WM_STYLECHANGING = 0x007C; + public const int WM_SYNCPAINT = 0x0088; + public const int WM_SYSCHAR = 0x0106; + public const int WM_SYSCOLORCHANGE = 0x0015; + public const int WM_SYSCOMMAND = 0x0112; + public const int WM_SYSDEADCHAR = 0x0107; + public const int WM_SYSKEYDOWN = 0x0104; + public const int WM_SYSKEYUP = 0x0105; + public const int WM_TCARD = 0x0052; + public const int WM_TIMECHANGE = 0x001E; + public const int WM_TIMER = 0x0113; + public const int WM_UNDO = 0x0304; + public const int WM_UNINITMENUPOPUP = 0x0125; + public const int WM_USER = 0x0400; + public const int WM_USERCHANGED = 0x0054; + public const int WM_VKEYTOITEM = 0x002E; + public const int WM_VSCROLL = 0x0115; + public const int WM_VSCROLLCLIPBOARD = 0x030A; + public const int WM_WINDOWPOSCHANGED = 0x0047; + public const int WM_WINDOWPOSCHANGING = 0x0046; + public const int WM_WININICHANGE = 0x001A; + public const int WM_XBUTTONDBLCLK = 0x020D; + public const int WM_XBUTTONDOWN = 0x020B; + public const int WM_XBUTTONUP = 0x020C; + + #endregion + + public const uint WHITE_BRUSH = 0; + public const uint LTGRAY_BRUSH = 1; + public const uint GRAY_BRUSH = 2; + public const uint DKGRAY_BRUSH = 3; + public const uint BLACK_BRUSH = 4; + public const uint NULL_BRUSH = 5; + public const uint HOLLOW_BRUSH = NULL_BRUSH; + public const uint WHITE_PEN = 6; + public const uint BLACK_PEN = 7; + public const uint NULL_PEN = 8; + public const uint OEM_FIXED_FONT = 10; + public const uint ANSI_FIXED_FONT = 11; + public const uint ANSI_VAR_FONT = 12; + public const uint SYSTEM_FONT = 13; + public const uint DEVICE_DEFAULT_FONT = 14; + public const uint DEFAULT_PALETTE = 15; + public const uint SYSTEM_FIXED_FONT = 16; + public const uint DEFAULT_GUI_FONT = 17; + public const uint DC_BRUSH = 18; + public const uint DC_PEN = 19; + + public const uint DEFAULT_PITCH = 0; + public const uint FIXED_PITCH = 1; + public const uint VARIABLE_PITCH = 2; + + public const uint DEFAULT_QUALITY = 0; + public const uint DRAFT_QUALITY = 1; + public const uint PROOF_QUALITY = 2; + public const uint NONANTIALIASED_QUALITY = 3; + public const uint ANTIALIASED_QUALITY = 4; + public const uint CLEARTYPE_QUALITY = 5; + public const uint CLEARTYPE_NATURAL_QUALITY = 6; + + public const uint CLIP_DEFAULT_PRECIS = 0; + public const uint CLIP_CHARACTER_PRECIS = 1; + public const uint CLIP_STROKE_PRECIS = 2; + public const uint CLIP_MASK = 0xf; + + public const uint OUT_DEFAULT_PRECIS = 0; + public const uint OUT_STRING_PRECIS = 1; + public const uint OUT_CHARACTER_PRECIS = 2; + public const uint OUT_STROKE_PRECIS = 3; + public const uint OUT_TT_PRECIS = 4; + public const uint OUT_DEVICE_PRECIS = 5; + public const uint OUT_RASTER_PRECIS = 6; + public const uint OUT_TT_ONLY_PRECIS = 7; + public const uint OUT_OUTLINE_PRECIS = 8; + public const uint OUT_SCREEN_OUTLINE_PRECIS = 9; + public const uint OUT_PS_ONLY_PRECIS = 10; + + public const uint ANSI_CHARSET = 0; + public const uint DEFAULT_CHARSET = 1; + public const uint SYMBOL_CHARSET = 2; + + public const uint FW_DONTCARE = 0; + public const uint FW_THIN = 100; + public const uint FW_EXTRALIGHT = 200; + public const uint FW_LIGHT = 300; + public const uint FW_NORMAL = 400; + public const uint FW_MEDIUM = 500; + public const uint FW_SEMIBOLD = 600; + public const uint FW_BOLD = 700; + public const uint FW_EXTRABOLD = 800; + public const uint FW_HEAVY = 900; + + public const uint SRCCOPY = 0x00CC0020; // dest = source + public const uint SRCPAINT = 0x00EE0086; // dest = source OR dest + public const uint SRCAND = 0x008800C6; // dest = source AND dest + public const uint SRCINVERT = 0x00660046; // dest = source XOR dest + public const uint SRCERASE = 0x00440328; // dest = source AND (NOT dest ) + public const uint NOTSRCCOPY = 0x00330008; // dest = (NOT source) + public const uint NOTSRCERASE = 0x001100A6; // dest = (NOT src) AND (NOT dest) + public const uint MERGECOPY = 0x00C000CA; // dest = (source AND pattern) + public const uint MERGEPAINT = 0x00BB0226; // dest = (NOT source) OR dest + public const uint PATCOPY = 0x00F00021; // dest = pattern + public const uint PATPAINT = 0x00FB0A09; // dest = DPSnoo + public const uint PATINVERT = 0x005A0049; // dest = pattern XOR dest + public const uint DSTINVERT = 0x00550009; // dest = (NOT dest) + public const uint BLACKNESS = 0x00000042; // dest = BLACK + public const uint WHITENESS = 0x00FF0062; // dest = WHITE + + public const uint DIB_RGB_COLORS = 0; + public const uint DIB_PAL_COLORS = 1; + + public const uint CS_VREDRAW = 0x0001; + public const uint CS_HREDRAW = 0x0002; + public const uint CS_DBLCLKS = 0x0008; + public const uint CS_OWNDC = 0x0020; + public const uint CS_CLASSDC = 0x0040; + public const uint CS_PARENTDC = 0x0080; + public const uint CS_NOCLOSE = 0x0200; + public const uint CS_SAVEBITS = 0x0800; + public const uint CS_BYTEALIGNCLIENT = 0x1000; + public const uint CS_BYTEALIGNWINDOW = 0x2000; + public const uint CS_GLOBALCLASS = 0x4000; + } +} diff --git a/src/canvas.cs b/src/canvas.cs index 87c2049..bc05418 100644 --- a/src/canvas.cs +++ b/src/canvas.cs @@ -1,6 +1,5 @@ using System; using System.Windows.Forms; -using System.Diagnostics; using SharpGL.Enumerations; using SharpGL.Version; using SharpGL; @@ -18,7 +17,7 @@ namespace JuicyGraphics { } protected void InitializeOpenGL() { - GL.Create(OpenGLVersion.OpenGL2_1, RenderContextType.NativeWindow, Width, Height, 32, this.Handle); + GL.Create(OpenGLVersion.OpenGL4_3, RenderContextType.NativeWindow, Width, Height, 32, this.Handle); GL.ShadeModel(OpenGL.GL_SMOOTH); GL.ClearDepth(1.0f); GL.Enable(OpenGL.GL_DEPTH_TEST); @@ -45,6 +44,7 @@ namespace JuicyGraphics { if (renderingForDesigner()) { base.OnPaintBackground(e); } return; } + protected override void OnPaint(PaintEventArgs e) { if (renderingForDesigner()) { SetStyle(ControlStyles.AllPaintingInWmPaint, true); @@ -75,8 +75,7 @@ namespace JuicyGraphics { Invalidate(); } - public void BeginInit() { - } + public void BeginInit() { } public void EndInit() { InitializeOpenGL(); diff --git a/src/packages.config b/src/packages.config deleted file mode 100644 index 2dab5a5..0000000 --- a/src/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file