| 1 |
#ifndef __GLX_glx_h__ |
| 2 |
#define __GLX_glx_h__ |
| 3 |
|
| 4 |
/* |
| 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. |
| 36 |
*/ |
| 37 |
|
| 38 |
#include <nx-X11/Xlib.h> |
| 39 |
#include <nx-X11/Xutil.h> |
| 40 |
#include <GL/gl.h> |
| 41 |
#include <GL/glxtokens.h> |
| 42 |
|
| 43 |
#ifdef __cplusplus |
| 44 |
extern "C" { |
| 45 |
#endif |
| 46 |
|
| 47 |
/* |
| 48 |
** GLX resources. |
| 49 |
*/ |
| 50 |
typedef XID GLXContextID; |
| 51 |
typedef XID GLXPixmap; |
| 52 |
typedef XID GLXDrawable; |
| 53 |
typedef XID GLXPbuffer; |
| 54 |
typedef XID GLXWindow; |
| 55 |
typedef XID GLXFBConfigID; |
| 56 |
|
| 57 |
/* |
| 58 |
** GLXContext is a pointer to opaque data. |
| 59 |
*/ |
| 60 |
typedef struct __GLXcontextRec *GLXContext; |
| 61 |
|
| 62 |
/* |
| 63 |
** GLXFBConfig is a pointer to opaque data. |
| 64 |
*/ |
| 65 |
typedef struct __GLXFBConfigRec *GLXFBConfig; |
| 66 |
|
| 67 |
/************************************************************************/ |
| 68 |
|
| 69 |
extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList); |
| 70 |
extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); |
| 71 |
extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); |
| 72 |
extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap); |
| 73 |
extern void glXDestroyContext (Display *dpy, GLXContext ctx); |
| 74 |
extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix); |
| 75 |
extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value); |
| 76 |
extern GLXContext glXGetCurrentContext (void); |
| 77 |
extern GLXDrawable glXGetCurrentDrawable (void); |
| 78 |
extern Bool glXIsDirect (Display *dpy, GLXContext ctx); |
| 79 |
extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx); |
| 80 |
extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); |
| 81 |
extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); |
| 82 |
extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); |
| 83 |
extern void glXUseXFont (Font font, int first, int count, int listBase); |
| 84 |
extern void glXWaitGL (void); |
| 85 |
extern void glXWaitX (void); |
| 86 |
extern const char * glXGetClientString (Display *dpy, int name ); |
| 87 |
extern const char * glXQueryServerString (Display *dpy, int screen, int name ); |
| 88 |
extern const char * glXQueryExtensionsString (Display *dpy, int screen ); |
| 89 |
|
| 90 |
/* New for GLX 1.3 */ |
| 91 |
extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements); |
| 92 |
extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); |
| 93 |
extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); |
| 94 |
extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); |
| 95 |
extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); |
| 96 |
extern void glXDestroyWindow (Display *dpy, GLXWindow win); |
| 97 |
extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); |
| 98 |
extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); |
| 99 |
extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); |
| 100 |
extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); |
| 101 |
extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); |
| 102 |
extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); |
| 103 |
extern Bool glXMakeContextCurrent (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); |
| 104 |
extern GLXDrawable glXGetCurrentReadDrawable (void); |
| 105 |
extern Display * glXGetCurrentDisplay (void); |
| 106 |
extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); |
| 107 |
extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); |
| 108 |
extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); |
| 109 |
|
| 110 |
/* GLX 1.4 and later */ |
| 111 |
extern void (*glXGetProcAddress(const GLubyte *procname))(void); |
| 112 |
|
| 113 |
|
| 114 |
#ifndef GLX_GLXEXT_LEGACY |
| 115 |
|
| 116 |
#include <GL/glxext.h> |
| 117 |
|
| 118 |
#else |
| 119 |
|
| 120 |
/* GLX extensions */ |
| 121 |
#define GLX_EXT_import_context 1 |
| 122 |
#define GLX_EXT_visual_info 1 |
| 123 |
#define GLX_EXT_visual_rating 1 |
| 124 |
#define GLX_ARB_get_proc_address 1 |
| 125 |
extern GLXContextID glXGetContextIDEXT (const GLXContext ctx); |
| 126 |
extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); |
| 127 |
extern void glXFreeContextEXT (Display *dpy, GLXContext ctx); |
| 128 |
extern int glXQueryContextInfoEXT (Display *dpy, GLXContext ctx, int attribute, int *value); |
| 129 |
extern Display * glXGetCurrentDisplayEXT (void); |
| 130 |
extern void (*glXGetProcAddressARB(const GLubyte *procName))( void ); |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
#endif /* GLX_GLXEXT_LEGACY */ |
| 135 |
|
| 136 |
|
| 137 |
/** |
| 138 |
** The following aren't in glxext.h yet. |
| 139 |
**/ |
| 140 |
|
| 141 |
|
| 142 |
/* |
| 143 |
* ???. GLX_NV_vertex_array_range |
| 144 |
*/ |
| 145 |
#ifndef GLX_NV_vertex_array_range |
| 146 |
#define GLX_NV_vertex_array_range |
| 147 |
|
| 148 |
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
| 149 |
extern void glXFreeMemoryNV(GLvoid *pointer); |
| 150 |
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
| 151 |
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); |
| 152 |
|
| 153 |
#endif /* GLX_NV_vertex_array_range */ |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
/* |
| 158 |
* ???. GLX_MESA_agp_offset (deprecated) |
| 159 |
*/ |
| 160 |
#ifndef GLX_MESA_agp_offset |
| 161 |
#define GLX_MESA_agp_offset 1 |
| 162 |
|
| 163 |
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); |
| 164 |
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); |
| 165 |
|
| 166 |
#endif /* GLX_MESA_agp_offset */ |
| 167 |
|
| 168 |
|
| 169 |
/* |
| 170 |
* ???. GLX_MESA_allocate_memory |
| 171 |
*/ |
| 172 |
#ifndef GLX_MESA_allocate_memory |
| 173 |
#define GLX_MESA_allocate_memory 1 |
| 174 |
|
| 175 |
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); |
| 176 |
extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); |
| 177 |
extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer); |
| 178 |
typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); |
| 179 |
typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer); |
| 180 |
typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer); |
| 181 |
|
| 182 |
#endif /* GLX_MESA_allocate_memory */ |
| 183 |
|
| 184 |
/* |
| 185 |
* ???. GLX_ARB_render_texture |
| 186 |
*/ |
| 187 |
#ifndef GLX_ARB_render_texture |
| 188 |
#define GLX_ARB_render_texture 1 |
| 189 |
|
| 190 |
Bool glXBindTexImageARB( Display *dpy, GLXPbuffer pbuffer, int buffer ); |
| 191 |
Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer ); |
| 192 |
Bool glXDrawableAttribARB( Display *dpy, GLXDrawable draw, const int *attribList ); |
| 193 |
|
| 194 |
#endif |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
/*** Should these go here, or in another header? */ |
| 199 |
/* |
| 200 |
** GLX Events |
| 201 |
*/ |
| 202 |
typedef struct { |
| 203 |
int event_type; /* GLX_DAMAGED or GLX_SAVED */ |
| 204 |
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ |
| 205 |
unsigned long serial; /* # of last request processed by server */ |
| 206 |
Bool send_event; /* true if this came for SendEvent request */ |
| 207 |
Display *display; /* display the event was read from */ |
| 208 |
GLXDrawable drawable; /* XID of Drawable */ |
| 209 |
unsigned int buffer_mask; /* mask indicating which buffers are affected */ |
| 210 |
unsigned int aux_buffer; /* which aux buffer was affected */ |
| 211 |
int x, y; |
| 212 |
int width, height; |
| 213 |
int count; /* if nonzero, at least this many more */ |
| 214 |
} GLXPbufferClobberEvent; |
| 215 |
|
| 216 |
typedef union __GLXEvent { |
| 217 |
GLXPbufferClobberEvent glxpbufferclobber; |
| 218 |
long pad[24]; |
| 219 |
} GLXEvent; |
| 220 |
|
| 221 |
#ifdef __cplusplus |
| 222 |
} |
| 223 |
#endif |
| 224 |
|
| 225 |
#endif /* !__GLX_glx_h__ */ |