FreeWRL / FreeX3D 4.3.0
GLwDrawA.h
1/*
2** License Applicability. Except to the extent portions of this file are
3** made subject to an alternative license as permitted in the SGI Free
4** Software License B, Version 1.1 (the "License"), the contents of this
5** file are subject only to the provisions of the License. You may not use
6** this file except in compliance with the License. You may obtain a copy
7** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
9**
10** http://oss.sgi.com/projects/FreeB
11**
12** Note that, as provided in the License, the Software is distributed on an
13** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
17**
18** Original Code. The Original Code is: OpenGL Sample Implementation,
19** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21** Copyright in any portions created by third parties is as indicated
22** elsewhere herein. All Rights Reserved.
23**
24** Additional Notice Provisions: The application programming interfaces
25** established by SGI in conjunction with the Original Code are The
26** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29** Window System(R) (Version 1.3), released October 19, 1998. This software
30** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31** published by SGI, but has not been independently verified as being
32** compliant with the OpenGL(R) version 1.2.1 Specification.
33**
34*/
35
36/*
37** This file has been slightly modified from the original by Carlos A. M. dos
38** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
39** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
40** in the same library.
41*/
42/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h,v 1.3 2001/05/02 13:37:45 dawes Exp $ */
43
44#ifndef _GLwDrawA_h
45#define _GLwDrawA_h
46
47#ifdef __GLX_MOTIF
48# ifndef __GLX_INCLUDE_XM_H /* Defined during library compilation */
49# include <Xm/Xm.h> /* We need to know about XmVERSION early */
50# endif
51#endif
52
53#include <GL/glx.h>
54#include <GL/gl.h>
55
56/****************************************************************
57 *
58 * GLwDrawingArea widgets
59 *
60 ****************************************************************/
61
62/* Resources:
63
64 Name Class RepType Default Value
65 ---- ----- ------- -------------
66 attribList AttribList int * NULL
67 visualInfo VisualInfo VisualInfo NULL
68 installColormap InstallColormap Boolean TRUE
69 allocateBackground AllocateColors Boolean FALSE
70 allocateOtherColors AllocateColors Boolean FALSE
71 installBackground InstallBackground Boolean TRUE
72 exposeCallback Callback Pointer NULL
73 ginitCallback Callback Pointer NULL
74 inputCallback Callback Pointer NULL
75 resizeCallback Callback Pointer NULL
76
77*** The following resources all correspond to the GLX configuration
78*** attributes and are used to create the attribList if it is NULL
79 bufferSize BufferSize int 0
80 level Level int 0
81 rgba Rgba Boolean FALSE
82 doublebuffer Doublebuffer Boolean FALSE
83 stereo Stereo Boolean FALSE
84 auxBuffers AuxBuffers int 0
85 redSize ColorSize int 1
86 greenSize ColorSize int 1
87 blueSize ColorSize int 1
88 alphaSize AlphaSize int 0
89 depthSize DepthSize int 0
90 stencilSize StencilSize int 0
91 accumRedSize AccumColorSize int 0
92 accumGreenSize AccumColorSize int 0
93 accumBlueSize AccumColorSize int 0
94 accumAlphaSize AccumAlphaSize int 0
95*/
96
97#define GLwNattribList "attribList"
98#define GLwCAttribList "AttribList"
99#define GLwNvisualInfo "visualInfo"
100#define GLwCVisualInfo "VisualInfo"
101#define GLwRVisualInfo "VisualInfo"
102
103#define GLwNinstallColormap "installColormap"
104#define GLwCInstallColormap "InstallColormap"
105#define GLwNallocateBackground "allocateBackground"
106#define GLwNallocateOtherColors "allocateOtherColors"
107#define GLwCAllocateColors "AllocateColors"
108#define GLwNinstallBackground "installBackground"
109#define GLwCInstallBackground "InstallBackground"
110
111#define GLwCCallback "Callback"
112#define GLwNexposeCallback "exposeCallback"
113#define GLwNginitCallback "ginitCallback"
114#define GLwNresizeCallback "resizeCallback"
115#define GLwNinputCallback "inputCallback"
116
117#define GLwNbufferSize "bufferSize"
118#define GLwCBufferSize "BufferSize"
119#define GLwNlevel "level"
120#define GLwCLevel "Level"
121#define GLwNrgba "rgba"
122#define GLwCRgba "Rgba"
123#define GLwNdoublebuffer "doublebuffer"
124#define GLwCDoublebuffer "Doublebuffer"
125#define GLwNstereo "stereo"
126#define GLwCStereo "Stereo"
127#define GLwNauxBuffers "auxBuffers"
128#define GLwCAuxBuffers "AuxBuffers"
129#define GLwNredSize "redSize"
130#define GLwNgreenSize "greenSize"
131#define GLwNblueSize "blueSize"
132#define GLwCColorSize "ColorSize"
133#define GLwNalphaSize "alphaSize"
134#define GLwCAlphaSize "AlphaSize"
135#define GLwNdepthSize "depthSize"
136#define GLwCDepthSize "DepthSize"
137#define GLwNstencilSize "stencilSize"
138#define GLwCStencilSize "StencilSize"
139#define GLwNaccumRedSize "accumRedSize"
140#define GLwNaccumGreenSize "accumGreenSize"
141#define GLwNaccumBlueSize "accumBlueSize"
142#define GLwCAccumColorSize "AccumColorSize"
143#define GLwNaccumAlphaSize "accumAlphaSize"
144#define GLwCAccumAlphaSize "AccumAlphaSize"
145
146#ifdef __GLX_MOTIF
147
148#if XmVERSION == 1
149/*
150# define _GLwMDrawingAreaClassRec _GLwM1DrawingAreaClassRec
151# define _GLwMDrawingAreaRec _GLwM1DrawingAreaRec
152*/
153# define glwMDrawingAreaWidgetClass glwM1DrawingAreaWidgetClass
154# define glwMDrawingAreaClassRec glwM1DrawingAreaClassRec
155# define GLwCreateMDrawingArea GLwCreateM1DrawingArea
156#elif XmVERSION == 2
157/*
158# define _GLwMDrawingAreaClassRec _GLwM2DrawingAreaClassRec
159# define _GLwMDrawingAreaRec _GLwM2DrawingAreaRec
160*/
161# define glwMDrawingAreaWidgetClass glwM2DrawingAreaWidgetClass
162# define glwMDrawingAreaClassRec glwM2DrawingAreaClassRec
163# define GLwCreateMDrawingArea GLwCreateM2DrawingArea
164#else
165#error "Sorry, unknown Motif version."
166#endif /* XmVERSION */
167
168typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass;
169typedef struct _GLwMDrawingAreaRec *GLwMDrawingAreaWidget;
170
171extern WidgetClass glwMDrawingAreaWidgetClass;
172
173#else /* not __GLX_MOTIF */
174
177
178extern WidgetClass glwDrawingAreaWidgetClass;
179
180#endif /* __GLX_MOTIF */
181
182/* Callback reasons */
183#ifdef __GLX_MOTIF
184#define GLwCR_EXPOSE XmCR_EXPOSE
185#define GLwCR_RESIZE XmCR_RESIZE
186#define GLwCR_INPUT XmCR_INPUT
187#else /* not __GLX_MOTIF */
188/* The same values as Motif, but don't use Motif constants */
189#define GLwCR_EXPOSE 38
190#define GLwCR_RESIZE 39
191#define GLwCR_INPUT 40
192#endif /* __GLX_MOTIF */
193
194#define GLwCR_GINIT 32135 /* Arbitrary number that should neverr clash*/
195
196typedef struct
197{
198 int reason;
199 XEvent *event;
200 Dimension width, height; /* for resize callback */
202
203#if defined(__cplusplus) || defined(c_plusplus)
204extern "C" {
205#endif
206
207/* front ends to glXMakeCurrent and glXSwapBuffers */
208extern void GLwDrawingAreaMakeCurrent (Widget w, GLXContext ctx);
209extern void GLwDrawingAreaSwapBuffers (Widget w);
210
211#ifdef __GLX_MOTIF
212#ifdef _NO_PROTO
213extern Widget GLwCreateMDrawingArea ();
214#else /* _NO_PROTO */
215
216extern Widget GLwCreateMDrawingArea (Widget parent, char *name,
217 ArgList arglist, Cardinal argcount);
218#endif /* _NO_PROTO */
219
220#endif /* __GLX_MOTIF */
221
222#if defined(__cplusplus) || defined(c_plusplus)
223}
224#endif
225
226#endif /* _GLwDrawA_h */