| 1 | /* |
|---|
| 2 | * (c) Copyright 1993, Silicon Graphics, Inc. |
|---|
| 3 | * ALL RIGHTS RESERVED |
|---|
| 4 | * Permission to use, copy, modify, and distribute this software for |
|---|
| 5 | * any purpose and without fee is hereby granted, provided that the above |
|---|
| 6 | * copyright notice appear in all copies and that both the copyright notice |
|---|
| 7 | * and this permission notice appear in supporting documentation, and that |
|---|
| 8 | * the name of Silicon Graphics, Inc. not be used in advertising |
|---|
| 9 | * or publicity pertaining to distribution of the software without specific, |
|---|
| 10 | * written prior permission. |
|---|
| 11 | * |
|---|
| 12 | * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" |
|---|
| 13 | * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, |
|---|
| 14 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR |
|---|
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON |
|---|
| 16 | * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, |
|---|
| 17 | * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY |
|---|
| 18 | * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, |
|---|
| 19 | * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF |
|---|
| 20 | * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN |
|---|
| 21 | * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON |
|---|
| 22 | * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE |
|---|
| 23 | * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. |
|---|
| 24 | * |
|---|
| 25 | * |
|---|
| 26 | * US Government Users Restricted Rights |
|---|
| 27 | * Use, duplication, or disclosure by the Government is subject to |
|---|
| 28 | * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph |
|---|
| 29 | * (c)(1)(ii) of the Rights in Technical Data and Computer Software |
|---|
| 30 | * clause at DFARS 252.227-7013 and/or in similar or successor |
|---|
| 31 | * clauses in the FAR or the DOD or NASA FAR Supplement. |
|---|
| 32 | * Unpublished-- rights reserved under the copyright laws of the |
|---|
| 33 | * United States. Contractor/manufacturer is Silicon Graphics, |
|---|
| 34 | * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. |
|---|
| 35 | * |
|---|
| 36 | * OpenGL(TM) is a trademark of Silicon Graphics, Inc. |
|---|
| 37 | */ |
|---|
| 38 | #ifndef _GLwDrawA_h |
|---|
| 39 | #define _GLwDrawA_h |
|---|
| 40 | |
|---|
| 41 | // #include <GL/glxew.h> |
|---|
| 42 | #include <GL/glx.h> |
|---|
| 43 | #include <GL/gl.h> |
|---|
| 44 | |
|---|
| 45 | // ------------------------------- |
|---|
| 46 | // GLwDrawingArea widgets |
|---|
| 47 | |
|---|
| 48 | /* Resources: |
|---|
| 49 | |
|---|
| 50 | Name Class RepType Default Value |
|---|
| 51 | ---- ----- ------- ------------- |
|---|
| 52 | attribList AttribList int * NULL |
|---|
| 53 | visualInfo VisualInfo VisualInfo NULL |
|---|
| 54 | installColormap InstallColormap Boolean TRUE |
|---|
| 55 | allocateBackground AllocateColors Boolean FALSE |
|---|
| 56 | allocateOtherColors AllocateColors Boolean FALSE |
|---|
| 57 | installBackground InstallBackground Boolean TRUE |
|---|
| 58 | exposeCallback Callback Pointer NULL |
|---|
| 59 | ginitCallback Callback Pointer NULL |
|---|
| 60 | inputCallback Callback Pointer NULL |
|---|
| 61 | resizeCallback Callback Pointer NULL |
|---|
| 62 | |
|---|
| 63 | *** The following resources all correspond to the GLX configuration |
|---|
| 64 | *** attributes and are used to create the attribList if it is NULL |
|---|
| 65 | bufferSize BufferSize int 0 |
|---|
| 66 | level Level int 0 |
|---|
| 67 | rgba Rgba Boolean FALSE |
|---|
| 68 | doublebuffer Doublebuffer Boolean FALSE |
|---|
| 69 | stereo Stereo Boolean FALSE |
|---|
| 70 | auxBuffers AuxBuffers int 0 |
|---|
| 71 | redSize ColorSize int 1 |
|---|
| 72 | greenSize ColorSize int 1 |
|---|
| 73 | blueSize ColorSize int 1 |
|---|
| 74 | alphaSize AlphaSize int 0 |
|---|
| 75 | depthSize DepthSize int 0 |
|---|
| 76 | stencilSize StencilSize int 0 |
|---|
| 77 | accumRedSize AccumColorSize int 0 |
|---|
| 78 | accumGreenSize AccumColorSize int 0 |
|---|
| 79 | accumBlueSize AccumColorSize int 0 |
|---|
| 80 | accumAlphaSize AccumAlphaSize int 0 |
|---|
| 81 | */ |
|---|
| 82 | |
|---|
| 83 | #define GLwNattribList "attribList" |
|---|
| 84 | #define GLwCAttribList "AttribList" |
|---|
| 85 | #define GLwNvisualInfo "visualInfo" |
|---|
| 86 | #define GLwCVisualInfo "VisualInfo" |
|---|
| 87 | #define GLwRVisualInfo "VisualInfo" |
|---|
| 88 | |
|---|
| 89 | #define GLwNinstallColormap "installColormap" |
|---|
| 90 | #define GLwCInstallColormap "InstallColormap" |
|---|
| 91 | #define GLwNallocateBackground "allocateBackground" |
|---|
| 92 | #define GLwNallocateOtherColors "allocateOtherColors" |
|---|
| 93 | #define GLwCAllocateColors "AllocateColors" |
|---|
| 94 | #define GLwNinstallBackground "installBackground" |
|---|
| 95 | #define GLwCInstallBackground "InstallBackground" |
|---|
| 96 | |
|---|
| 97 | #define GLwCCallback "Callback" |
|---|
| 98 | #define GLwNexposeCallback "exposeCallback" |
|---|
| 99 | #define GLwNginitCallback "ginitCallback" |
|---|
| 100 | #define GLwNresizeCallback "resizeCallback" |
|---|
| 101 | #define GLwNinputCallback "inputCallback" |
|---|
| 102 | |
|---|
| 103 | #define GLwNbufferSize "bufferSize" |
|---|
| 104 | #define GLwCBufferSize "BufferSize" |
|---|
| 105 | #define GLwNlevel "level" |
|---|
| 106 | #define GLwCLevel "Level" |
|---|
| 107 | #define GLwNrgba "rgba" |
|---|
| 108 | #define GLwCRgba "Rgba" |
|---|
| 109 | #define GLwNdoublebuffer "doublebuffer" |
|---|
| 110 | #define GLwCDoublebuffer "Doublebuffer" |
|---|
| 111 | #define GLwNstereo "stereo" |
|---|
| 112 | #define GLwCStereo "Stereo" |
|---|
| 113 | #define GLwNauxBuffers "auxBuffers" |
|---|
| 114 | #define GLwCAuxBuffers "AuxBuffers" |
|---|
| 115 | #define GLwNredSize "redSize" |
|---|
| 116 | #define GLwNgreenSize "greenSize" |
|---|
| 117 | #define GLwNblueSize "blueSize" |
|---|
| 118 | #define GLwCColorSize "ColorSize" |
|---|
| 119 | #define GLwNalphaSize "alphaSize" |
|---|
| 120 | #define GLwCAlphaSize "AlphaSize" |
|---|
| 121 | #define GLwNdepthSize "depthSize" |
|---|
| 122 | #define GLwCDepthSize "DepthSize" |
|---|
| 123 | #define GLwNstencilSize "stencilSize" |
|---|
| 124 | #define GLwCStencilSize "StencilSize" |
|---|
| 125 | #define GLwNaccumRedSize "accumRedSize" |
|---|
| 126 | #define GLwNaccumGreenSize "accumGreenSize" |
|---|
| 127 | #define GLwNaccumBlueSize "accumBlueSize" |
|---|
| 128 | #define GLwCAccumColorSize "AccumColorSize" |
|---|
| 129 | #define GLwNaccumAlphaSize "accumAlphaSize" |
|---|
| 130 | #define GLwCAccumAlphaSize "AccumAlphaSize" |
|---|
| 131 | |
|---|
| 132 | #ifdef __GLX_MOTIF |
|---|
| 133 | |
|---|
| 134 | typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass; |
|---|
| 135 | typedef struct _GLwMDrawingAreaRec *GLwMDrawingAreaWidget; |
|---|
| 136 | |
|---|
| 137 | // BUG. Extended by Daniel Koitzsch and Christian Becker |
|---|
| 138 | // #define glwMDrawingAreaWidgetClass glwM1DrawingAreaWidgetClass |
|---|
| 139 | // defining glwMDrawingAreaWidgetClass twice doesn't work |
|---|
| 140 | #define glwMDrawingAreaWidgetClass glwM2DrawingAreaWidgetClass |
|---|
| 141 | |
|---|
| 142 | extern WidgetClass glwMDrawingAreaWidgetClass; |
|---|
| 143 | |
|---|
| 144 | #else |
|---|
| 145 | |
|---|
| 146 | typedef struct _GLwDrawingAreaClassRec *GLwDrawingAreaWidgetClass; |
|---|
| 147 | typedef struct _GLwDrawingAreaRec *GLwDrawingAreaWidget; |
|---|
| 148 | |
|---|
| 149 | extern WidgetClass glwDrawingAreaWidgetClass; |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | #endif |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | // Callback reasons |
|---|
| 156 | #ifdef __GLX_MOTIF |
|---|
| 157 | #define GLwCR_EXPOSE XmCR_EXPOSE |
|---|
| 158 | #define GLwCR_RESIZE XmCR_RESIZE |
|---|
| 159 | #define GLwCR_INPUT XmCR_INPUT |
|---|
| 160 | #else |
|---|
| 161 | // The same values as Motif, but don't use Motif constants |
|---|
| 162 | #define GLwCR_EXPOSE 38 |
|---|
| 163 | #define GLwCR_RESIZE 39 |
|---|
| 164 | #define GLwCR_INPUT 40 |
|---|
| 165 | #endif |
|---|
| 166 | |
|---|
| 167 | #define GLwCR_GINIT 32135 // Arbitrary number that should neverr clash |
|---|
| 168 | |
|---|
| 169 | typedef struct |
|---|
| 170 | { |
|---|
| 171 | int reason; |
|---|
| 172 | XEvent *event; |
|---|
| 173 | Dimension width, height; |
|---|
| 174 | } GLwDrawingAreaCallbackStruct; |
|---|
| 175 | |
|---|
| 176 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 177 | extern "C" { |
|---|
| 178 | #endif |
|---|
| 179 | |
|---|
| 180 | // front ends to glXMakeCurrent and glXSwapBuffers |
|---|
| 181 | extern void GLwDrawingAreaMakeCurrent(Widget w, GLXContext ctx); |
|---|
| 182 | extern void GLwDrawingAreaSwapBuffers(Widget w); |
|---|
| 183 | |
|---|
| 184 | #ifdef __GLX_MOTIF |
|---|
| 185 | #ifdef _NO_PROTO |
|---|
| 186 | extern Widget GLwCreateMDrawingArea(); |
|---|
| 187 | #else |
|---|
| 188 | extern Widget GLwCreateMDrawingArea(Widget parent, char *name, ArgList arglist, Cardinal argcount); |
|---|
| 189 | #endif |
|---|
| 190 | #endif |
|---|
| 191 | |
|---|
| 192 | #if defined(__cplusplus) || defined(c_plusplus) |
|---|
| 193 | } |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | #endif |
|---|