Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 1 | #ifndef __gl_core_h_ |
| 2 | #define __gl_core_h_ |
| 3 | |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 4 | /* |
Keith Whitwell | a087c74 | 2001-01-13 05:47:06 +0000 | [diff] [blame] | 5 | ** License Applicability. Except to the extent portions of this file are |
| 6 | ** made subject to an alternative license as permitted in the SGI Free |
| 7 | ** Software License B, Version 1.1 (the "License"), the contents of this |
| 8 | ** file are subject only to the provisions of the License. You may not use |
| 9 | ** this file except in compliance with the License. You may obtain a copy |
| 10 | ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
| 11 | ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
| 12 | ** |
| 13 | ** http://oss.sgi.com/projects/FreeB |
| 14 | ** |
| 15 | ** Note that, as provided in the License, the Software is distributed on an |
| 16 | ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
| 17 | ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
| 18 | ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
| 19 | ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
| 20 | ** |
| 21 | ** Original Code. The Original Code is: OpenGL Sample Implementation, |
| 22 | ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
| 23 | ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
| 24 | ** Copyright in any portions created by third parties is as indicated |
| 25 | ** elsewhere herein. All Rights Reserved. |
| 26 | ** |
| 27 | ** Additional Notice Provisions: The application programming interfaces |
| 28 | ** established by SGI in conjunction with the Original Code are The |
| 29 | ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released |
| 30 | ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version |
| 31 | ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X |
| 32 | ** Window System(R) (Version 1.3), released October 19, 1998. This software |
| 33 | ** was created using the OpenGL(R) version 1.2.1 Sample Implementation |
| 34 | ** published by SGI, but has not been independently verified as being |
| 35 | ** compliant with the OpenGL(R) version 1.2.1 Specification. |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 36 | ** |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 37 | */ |
| 38 | |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 39 | #include <sys/types.h> |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 40 | |
| 41 | #define GL_CORE_SGI 1 |
| 42 | #define GL_CORE_MESA 2 |
Alan Hourihane | 3eb58b4 | 2003-12-04 12:33:15 +0000 | [diff] [blame] | 43 | #define GL_CORE_APPLE 4 |
George Sapountzis | fe20ac2 | 2007-09-25 12:49:29 +0300 | [diff] [blame] | 44 | #define GL_CORE_WINDOWS 8 |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 45 | |
| 46 | typedef struct __GLcontextRec __GLcontext; |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | ** This file defines the interface between the GL core and the surrounding |
| 50 | ** "operating system" that supports it (currently the GLX or WGL extensions). |
| 51 | ** |
| 52 | ** Members (data and function pointers) are documented as imported or |
| 53 | ** exported according to how they are used by the core rendering functions. |
| 54 | ** Imported members are initialized by the "operating system" and used by |
| 55 | ** the core functions. Exported members are initialized by the core functions |
| 56 | ** and used by the "operating system". |
| 57 | */ |
| 58 | |
Ian Romanick | 56f349515 | 2006-08-11 22:26:49 +0000 | [diff] [blame] | 59 | /** |
| 60 | * Mode and limit information for a context. This information is |
| 61 | * kept around in the context so that values can be used during |
| 62 | * command execution, and for returning information about the |
| 63 | * context to the application. |
| 64 | * |
| 65 | * Instances of this structure are shared by the driver and the loader. To |
| 66 | * maintain binary compatability, new fields \b must be added only to the |
| 67 | * end of the structure. |
| 68 | * |
| 69 | * \sa _gl_context_modes_create |
| 70 | */ |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 71 | typedef struct __GLcontextModesRec { |
Alan Hourihane | 3eb58b4 | 2003-12-04 12:33:15 +0000 | [diff] [blame] | 72 | struct __GLcontextModesRec * next; |
| 73 | |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 74 | GLboolean rgbMode; |
Alan Hourihane | 3eb58b4 | 2003-12-04 12:33:15 +0000 | [diff] [blame] | 75 | GLboolean floatMode; |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 76 | GLboolean colorIndexMode; |
Alan Hourihane | 3eb58b4 | 2003-12-04 12:33:15 +0000 | [diff] [blame] | 77 | GLuint doubleBufferMode; |
| 78 | GLuint stereoMode; |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 79 | |
| 80 | GLboolean haveAccumBuffer; |
| 81 | GLboolean haveDepthBuffer; |
| 82 | GLboolean haveStencilBuffer; |
| 83 | |
| 84 | GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ |
| 85 | GLuint redMask, greenMask, blueMask, alphaMask; |
| 86 | GLint rgbBits; /* total bits for rgb */ |
| 87 | GLint indexBits; /* total bits for colorindex */ |
| 88 | |
| 89 | GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; |
| 90 | GLint depthBits; |
| 91 | GLint stencilBits; |
| 92 | |
| 93 | GLint numAuxBuffers; |
| 94 | |
| 95 | GLint level; |
| 96 | |
| 97 | GLint pixmapMode; |
Alan Hourihane | 3eb58b4 | 2003-12-04 12:33:15 +0000 | [diff] [blame] | 98 | |
| 99 | /* GLX */ |
| 100 | GLint visualID; |
| 101 | GLint visualType; /**< One of the GLX X visual types. (i.e., |
| 102 | * \c GLX_TRUE_COLOR, etc.) |
| 103 | */ |
| 104 | |
| 105 | /* EXT_visual_rating / GLX 1.2 */ |
| 106 | GLint visualRating; |
| 107 | |
| 108 | /* EXT_visual_info / GLX 1.2 */ |
| 109 | GLint transparentPixel; |
| 110 | /* colors are floats scaled to ints */ |
| 111 | GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; |
| 112 | GLint transparentIndex; |
| 113 | |
| 114 | /* ARB_multisample / SGIS_multisample */ |
| 115 | GLint sampleBuffers; |
| 116 | GLint samples; |
| 117 | |
| 118 | /* SGIX_fbconfig / GLX 1.3 */ |
| 119 | GLint drawableType; |
| 120 | GLint renderType; |
| 121 | GLint xRenderable; |
| 122 | GLint fbconfigID; |
| 123 | |
| 124 | /* SGIX_pbuffer / GLX 1.3 */ |
| 125 | GLint maxPbufferWidth; |
| 126 | GLint maxPbufferHeight; |
| 127 | GLint maxPbufferPixels; |
| 128 | GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ |
| 129 | GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ |
| 130 | |
| 131 | /* SGIX_visual_select_group */ |
| 132 | GLint visualSelectGroup; |
| 133 | |
| 134 | /* OML_swap_method */ |
| 135 | GLint swapMethod; |
| 136 | |
| 137 | GLint screen; |
David Reveman | ba23f69 | 2006-04-11 12:21:48 +0000 | [diff] [blame] | 138 | |
| 139 | /* EXT_texture_from_pixmap */ |
| 140 | GLint bindToTextureRgb; |
| 141 | GLint bindToTextureRgba; |
| 142 | GLint bindToMipmapTexture; |
| 143 | GLint bindToTextureTargets; |
| 144 | GLint yInverted; |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 145 | } __GLcontextModes; |
| 146 | |
Ian Romanick | e1a7f31 | 2004-06-06 02:20:20 +0000 | [diff] [blame] | 147 | /* Several fields of __GLcontextModes can take these as values. Since |
| 148 | * GLX header files may not be available everywhere they need to be used, |
| 149 | * redefine them here. |
| 150 | */ |
| 151 | #define GLX_NONE 0x8000 |
| 152 | #define GLX_SLOW_CONFIG 0x8001 |
| 153 | #define GLX_TRUE_COLOR 0x8002 |
| 154 | #define GLX_DIRECT_COLOR 0x8003 |
| 155 | #define GLX_PSEUDO_COLOR 0x8004 |
| 156 | #define GLX_STATIC_COLOR 0x8005 |
| 157 | #define GLX_GRAY_SCALE 0x8006 |
| 158 | #define GLX_STATIC_GRAY 0x8007 |
| 159 | #define GLX_TRANSPARENT_RGB 0x8008 |
| 160 | #define GLX_TRANSPARENT_INDEX 0x8009 |
| 161 | #define GLX_NON_CONFORMANT_CONFIG 0x800D |
| 162 | #define GLX_SWAP_EXCHANGE_OML 0x8061 |
| 163 | #define GLX_SWAP_COPY_OML 0x8062 |
| 164 | #define GLX_SWAP_UNDEFINED_OML 0x8063 |
| 165 | |
| 166 | #define GLX_DONT_CARE 0xFFFFFFFF |
| 167 | |
| 168 | #define GLX_RGBA_BIT 0x00000001 |
| 169 | #define GLX_COLOR_INDEX_BIT 0x00000002 |
| 170 | #define GLX_WINDOW_BIT 0x00000001 |
| 171 | #define GLX_PIXMAP_BIT 0x00000002 |
| 172 | #define GLX_PBUFFER_BIT 0x00000004 |
| 173 | |
David Reveman | bea7fe5 | 2006-05-02 08:54:39 +0000 | [diff] [blame] | 174 | #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 |
| 175 | #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 |
| 176 | #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 |
| 177 | #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 |
| 178 | #define GLX_Y_INVERTED_EXT 0x20D4 |
David Reveman | ba23f69 | 2006-04-11 12:21:48 +0000 | [diff] [blame] | 179 | |
| 180 | #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 |
| 181 | #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 |
| 182 | #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 |
| 183 | |
George Sapountzis | 32a2a09 | 2008-04-18 17:34:24 +0300 | [diff] [blame^] | 184 | |
| 185 | /************************************************************************/ |
| 186 | |
| 187 | #ifdef _NEED_GL_CORE_IF |
| 188 | |
| 189 | /** |
| 190 | * The GLcore interface (a subset of the XMesa interface) |
| 191 | */ |
| 192 | #define __GL_CORE "GL_Core" |
| 193 | |
| 194 | typedef struct __GLcoreModuleRec { |
| 195 | /* |
| 196 | * XMesaVisual |
| 197 | */ |
| 198 | XMesaVisual (*XMesaCreateVisual)( ScreenPtr display, |
| 199 | VisualPtr visinfo, |
| 200 | GLboolean rgb_flag, |
| 201 | GLboolean alpha_flag, |
| 202 | GLboolean db_flag, |
| 203 | GLboolean stereo_flag, |
| 204 | GLboolean ximage_flag, |
| 205 | GLint depth_size, |
| 206 | GLint stencil_size, |
| 207 | GLint accum_red_size, |
| 208 | GLint accum_green_size, |
| 209 | GLint accum_blue_size, |
| 210 | GLint accum_alpha_size, |
| 211 | GLint num_samples, |
| 212 | GLint level, |
| 213 | GLint visualCaveat ); |
| 214 | |
| 215 | void (*XMesaDestroyVisual)( XMesaVisual v ); |
| 216 | |
| 217 | /* |
| 218 | * XMesaBuffer |
| 219 | */ |
| 220 | XMesaBuffer (*XMesaCreateWindowBuffer)( XMesaVisual v, |
| 221 | WindowPtr w ); |
| 222 | |
| 223 | XMesaBuffer (*XMesaCreatePixmapBuffer)( XMesaVisual v, |
| 224 | PixmapPtr p, |
| 225 | ColormapPtr cmap ); |
| 226 | |
| 227 | void (*XMesaDestroyBuffer)( XMesaBuffer b ); |
| 228 | |
| 229 | void (*XMesaSwapBuffers)( XMesaBuffer b ); |
| 230 | |
| 231 | void (*XMesaResizeBuffers)( XMesaBuffer b ); |
| 232 | |
| 233 | /* |
| 234 | * XMesaContext |
| 235 | */ |
| 236 | XMesaContext (*XMesaCreateContext)( XMesaVisual v, |
| 237 | XMesaContext share_list ); |
| 238 | |
| 239 | void (*XMesaDestroyContext)( XMesaContext c ); |
| 240 | |
| 241 | GLboolean (*XMesaCopyContext)( XMesaContext src, |
| 242 | XMesaContext dst, |
| 243 | GLuint mask ); |
| 244 | |
| 245 | GLboolean (*XMesaMakeCurrent2)( XMesaContext c, |
| 246 | XMesaBuffer drawBuffer, |
| 247 | XMesaBuffer readBuffer ); |
| 248 | |
| 249 | GLboolean (*XMesaForceCurrent)( XMesaContext c ); |
| 250 | |
| 251 | GLboolean (*XMesaLoseCurrent)( XMesaContext c ); |
| 252 | |
| 253 | } __GLcoreModule; |
| 254 | |
| 255 | #endif /* _NEED_GL_CORE_IF */ |
| 256 | |
Keith Whitwell | 7847794 | 2001-01-08 03:56:53 +0000 | [diff] [blame] | 257 | #endif /* __gl_core_h_ */ |