Merge branch 'glsl2-head' into glsl2
[profile/ivi/mesa.git] / src / glw / GLwDrawA.h
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/glx.h>
42 #include <GL/gl.h>
43
44 /****************************************************************
45  *
46  * GLwDrawingArea widgets
47  *
48  ****************************************************************/
49
50 /* Resources:
51
52  Name                Class              RepType         Default Value
53  ----                -----              -------         -------------
54  attribList          AttribList         int *           NULL
55  visualInfo          VisualInfo         VisualInfo      NULL
56  installColormap     InstallColormap    Boolean         TRUE
57  allocateBackground  AllocateColors     Boolean         FALSE
58  allocateOtherColors AllocateColors     Boolean         FALSE
59  installBackground   InstallBackground  Boolean         TRUE
60  exposeCallback      Callback           Pointer         NULL
61  ginitCallback       Callback           Pointer         NULL
62  inputCallback       Callback           Pointer         NULL
63  resizeCallback      Callback           Pointer         NULL
64
65 *** The following resources all correspond to the GLX configuration
66 *** attributes and are used to create the attribList if it is NULL
67  bufferSize          BufferSize         int             0
68  level               Level              int             0
69  rgba                Rgba               Boolean         FALSE
70  doublebuffer        Doublebuffer       Boolean         FALSE
71  stereo              Stereo             Boolean         FALSE
72  auxBuffers          AuxBuffers         int             0
73  redSize             ColorSize          int             1
74  greenSize           ColorSize          int             1
75  blueSize            ColorSize          int             1
76  alphaSize           AlphaSize          int             0
77  depthSize           DepthSize          int             0
78  stencilSize         StencilSize        int             0
79  accumRedSize        AccumColorSize     int             0
80  accumGreenSize      AccumColorSize     int             0
81  accumBlueSize       AccumColorSize     int             0
82  accumAlphaSize      AccumAlphaSize     int             0
83 */
84
85 #define GLwNattribList          "attribList"
86 #define GLwCAttribList          "AttribList"
87 #define GLwNvisualInfo          "visualInfo"
88 #define GLwCVisualInfo          "VisualInfo"
89 #define GLwRVisualInfo          "VisualInfo"
90
91 #define GLwNinstallColormap     "installColormap"
92 #define GLwCInstallColormap     "InstallColormap"
93 #define GLwNallocateBackground  "allocateBackground"
94 #define GLwNallocateOtherColors "allocateOtherColors"
95 #define GLwCAllocateColors      "AllocateColors"
96 #define GLwNinstallBackground   "installBackground"
97 #define GLwCInstallBackground   "InstallBackground"
98
99 #define GLwCCallback            "Callback"
100 #define GLwNexposeCallback      "exposeCallback"
101 #define GLwNginitCallback       "ginitCallback"
102 #define GLwNresizeCallback      "resizeCallback"
103 #define GLwNinputCallback       "inputCallback"
104
105 #define GLwNbufferSize          "bufferSize"
106 #define GLwCBufferSize          "BufferSize"
107 #define GLwNlevel               "level"
108 #define GLwCLevel               "Level"
109 #define GLwNrgba                "rgba"
110 #define GLwCRgba                "Rgba"
111 #define GLwNdoublebuffer        "doublebuffer"
112 #define GLwCDoublebuffer        "Doublebuffer"
113 #define GLwNstereo              "stereo"
114 #define GLwCStereo              "Stereo"
115 #define GLwNauxBuffers          "auxBuffers"
116 #define GLwCAuxBuffers          "AuxBuffers"
117 #define GLwNredSize             "redSize"
118 #define GLwNgreenSize           "greenSize"
119 #define GLwNblueSize            "blueSize"
120 #define GLwCColorSize           "ColorSize"
121 #define GLwNalphaSize           "alphaSize"
122 #define GLwCAlphaSize           "AlphaSize"
123 #define GLwNdepthSize           "depthSize"
124 #define GLwCDepthSize           "DepthSize"
125 #define GLwNstencilSize         "stencilSize"
126 #define GLwCStencilSize         "StencilSize"
127 #define GLwNaccumRedSize        "accumRedSize"
128 #define GLwNaccumGreenSize      "accumGreenSize"
129 #define GLwNaccumBlueSize       "accumBlueSize"
130 #define GLwCAccumColorSize      "AccumColorSize"
131 #define GLwNaccumAlphaSize      "accumAlphaSize"
132 #define GLwCAccumAlphaSize      "AccumAlphaSize"
133
134 #ifdef __GLX_MOTIF
135
136 typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass;
137 typedef struct _GLwMDrawingAreaRec      *GLwMDrawingAreaWidget;
138
139 extern WidgetClass glwMDrawingAreaWidgetClass;
140
141
142 #else 
143
144 typedef struct _GLwDrawingAreaClassRec  *GLwDrawingAreaWidgetClass;
145 typedef struct _GLwDrawingAreaRec       *GLwDrawingAreaWidget;
146
147 extern WidgetClass glwDrawingAreaWidgetClass;
148
149
150 #endif
151
152
153 /* Callback reasons */
154 #ifdef __GLX_MOTIF
155 #define GLwCR_EXPOSE    XmCR_EXPOSE
156 #define GLwCR_RESIZE    XmCR_RESIZE
157 #define GLwCR_INPUT     XmCR_INPUT
158 #else 
159 /* The same values as Motif, but don't use Motif constants */
160 #define GLwCR_EXPOSE    38
161 #define GLwCR_RESIZE    39
162 #define GLwCR_INPUT     40
163 #endif
164
165 #define GLwCR_GINIT     32135   /* Arbitrary number that should neverr clash */
166
167 typedef struct 
168   {
169   int       reason;
170   XEvent   *event;
171   Dimension width,height;
172   } 
173   GLwDrawingAreaCallbackStruct;
174
175 #if defined(__cplusplus) || defined(c_plusplus)
176 extern "C" {
177 #endif
178
179 /* front ends to glXMakeCurrent and glXSwapBuffers */
180 extern void GLwDrawingAreaMakeCurrent(Widget w,GLXContext ctx);
181 extern void GLwDrawingAreaSwapBuffers(Widget w);
182
183 #ifdef __GLX_MOTIF
184 #ifdef _NO_PROTO
185 GLAPI Widget GLwCreateMDrawingArea();
186 #else
187 GLAPI Widget GLwCreateMDrawingArea(Widget parent,char *name,ArgList arglist,Cardinal argcount);
188 #endif
189 #endif 
190
191 #if defined(__cplusplus) || defined(c_plusplus)
192 }
193 #endif
194
195 #endif