Browse Source

GL3D GWIN window + demo

inmarket 5 years ago
parent
commit
3b21507274
72 changed files with 12309 additions and 3 deletions
  1. 205 0
      3rdparty/tinygl-0.4-ugfx/BeOS/GLView.cpp
  2. 72 0
      3rdparty/tinygl-0.4-ugfx/BeOS/GLView.h
  3. 16 0
      3rdparty/tinygl-0.4-ugfx/BeOS/Makefile
  4. 38 0
      3rdparty/tinygl-0.4-ugfx/Changelog
  5. 10 0
      3rdparty/tinygl-0.4-ugfx/INSTALL
  6. 22 0
      3rdparty/tinygl-0.4-ugfx/LICENCE
  7. 206 0
      3rdparty/tinygl-0.4-ugfx/LIMITATIONS
  8. 15 0
      3rdparty/tinygl-0.4-ugfx/Makefile
  9. 150 0
      3rdparty/tinygl-0.4-ugfx/README
  10. 20 0
      3rdparty/tinygl-0.4-ugfx/README.BEOS
  11. 4 0
      3rdparty/tinygl-0.4-ugfx/README.uGFX
  12. 82 0
      3rdparty/tinygl-0.4-ugfx/config.mk
  13. 29 0
      3rdparty/tinygl-0.4-ugfx/examples/Makefile
  14. 300 0
      3rdparty/tinygl-0.4-ugfx/examples/gears.c
  15. 261 0
      3rdparty/tinygl-0.4-ugfx/examples/glu.c
  16. 23 0
      3rdparty/tinygl-0.4-ugfx/examples/glu.h
  17. 1753 0
      3rdparty/tinygl-0.4-ugfx/examples/mech.c
  18. 113 0
      3rdparty/tinygl-0.4-ugfx/examples/nanox.c
  19. 160 0
      3rdparty/tinygl-0.4-ugfx/examples/spin.c
  20. 193 0
      3rdparty/tinygl-0.4-ugfx/examples/texobj.c
  21. 17 0
      3rdparty/tinygl-0.4-ugfx/examples/ui.h
  22. 139 0
      3rdparty/tinygl-0.4-ugfx/examples/x11.c
  23. 838 0
      3rdparty/tinygl-0.4-ugfx/include/GL/gl.h
  24. 144 0
      3rdparty/tinygl-0.4-ugfx/include/GL/glx.h
  25. 27 0
      3rdparty/tinygl-0.4-ugfx/include/GL/nglx.h
  26. 37 0
      3rdparty/tinygl-0.4-ugfx/include/GL/oscontext.h
  27. 72 0
      3rdparty/tinygl-0.4-ugfx/include/GLView.h
  28. 43 0
      3rdparty/tinygl-0.4-ugfx/src/Makefile
  29. 667 0
      3rdparty/tinygl-0.4-ugfx/src/api.c
  30. 207 0
      3rdparty/tinygl-0.4-ugfx/src/arrays.c
  31. 30 0
      3rdparty/tinygl-0.4-ugfx/src/clear.c
  32. 445 0
      3rdparty/tinygl-0.4-ugfx/src/clip.c
  33. 22 0
      3rdparty/tinygl-0.4-ugfx/src/error.c
  34. 74 0
      3rdparty/tinygl-0.4-ugfx/src/get.c
  35. 413 0
      3rdparty/tinygl-0.4-ugfx/src/glx.c
  36. 136 0
      3rdparty/tinygl-0.4-ugfx/src/image_util.c
  37. 189 0
      3rdparty/tinygl-0.4-ugfx/src/init.c
  38. 306 0
      3rdparty/tinygl-0.4-ugfx/src/light.c
  39. 263 0
      3rdparty/tinygl-0.4-ugfx/src/list.c
  40. 247 0
      3rdparty/tinygl-0.4-ugfx/src/matrix.c
  41. 21 0
      3rdparty/tinygl-0.4-ugfx/src/memory.c
  42. 149 0
      3rdparty/tinygl-0.4-ugfx/src/misc.c
  43. 52 0
      3rdparty/tinygl-0.4-ugfx/src/msghandling.c
  44. 8 0
      3rdparty/tinygl-0.4-ugfx/src/msghandling.h
  45. 128 0
      3rdparty/tinygl-0.4-ugfx/src/nglx.c
  46. 71 0
      3rdparty/tinygl-0.4-ugfx/src/opinfo.h
  47. 83 0
      3rdparty/tinygl-0.4-ugfx/src/oscontext.c
  48. 116 0
      3rdparty/tinygl-0.4-ugfx/src/select.c
  49. 52 0
      3rdparty/tinygl-0.4-ugfx/src/specbuf.c
  50. 22 0
      3rdparty/tinygl-0.4-ugfx/src/specbuf.h
  51. 232 0
      3rdparty/tinygl-0.4-ugfx/src/texture.c
  52. 365 0
      3rdparty/tinygl-0.4-ugfx/src/vertex.c
  53. 517 0
      3rdparty/tinygl-0.4-ugfx/src/zbuffer.c
  54. 153 0
      3rdparty/tinygl-0.4-ugfx/src/zbuffer.h
  55. 158 0
      3rdparty/tinygl-0.4-ugfx/src/zdither.c
  56. 43 0
      3rdparty/tinygl-0.4-ugfx/src/zfeatures.h
  57. 372 0
      3rdparty/tinygl-0.4-ugfx/src/zgl.h
  58. 84 0
      3rdparty/tinygl-0.4-ugfx/src/zline.c
  59. 122 0
      3rdparty/tinygl-0.4-ugfx/src/zline.h
  60. 275 0
      3rdparty/tinygl-0.4-ugfx/src/zmath.c
  61. 53 0
      3rdparty/tinygl-0.4-ugfx/src/zmath.h
  62. 394 0
      3rdparty/tinygl-0.4-ugfx/src/ztriangle.c
  63. 363 0
      3rdparty/tinygl-0.4-ugfx/src/ztriangle.h
  64. 3 0
      demos/modules/gwin/gl3d/demo.mk
  65. 51 0
      demos/modules/gwin/gl3d/gfxconf.h
  66. 179 0
      demos/modules/gwin/gl3d/main.c
  67. 1 0
      gfxconf.example.h
  68. 171 0
      src/gwin/gwin_gl3d.c
  69. 70 0
      src/gwin/gwin_gl3d.h
  70. 3 2
      src/gwin/sys_defs.h
  71. 3 1
      src/gwin/sys_make.mk
  72. 7 0
      src/gwin/sys_options.h

+ 205 - 0
3rdparty/tinygl-0.4-ugfx/BeOS/GLView.cpp

@@ -0,0 +1,205 @@
1
+#include "GLView.h"
2
+#include <stdio.h>
3
+#include <interface/Bitmap.h>
4
+
5
+BLocker BGLView::locker;
6
+
7
+BGLView::BGLView(BRect rect, char *name,
8
+                 ulong resizingMode, ulong mode,
9
+                 ulong options)
10
+  : BView(rect, name, resizingMode, mode|B_FRAME_EVENTS|B_WILL_DRAW)
11
+{
12
+#ifdef __INTEL__
13
+  color_space cs = B_RGB16_LITTLE;
14
+#else
15
+  color_space cs = B_RGB16_BIG;
16
+#endif
17
+  this->bitmaps[0] = new BBitmap(rect, cs, false, true);
18
+  this->bitmaps[1] = new BBitmap(rect, cs, false, true);
19
+
20
+  this->currBitmap = 0;
21
+  int w = this->bitmaps[0]->BytesPerRow() / 2;
22
+  int h = rect.Height() + 1;
23
+  void *buffers[2];
24
+  buffers[0] = this->bitmaps[0]->Bits();
25
+  buffers[1] = this->bitmaps[1]->Bits();
26
+  this->context = ostgl_create_context(w, h, 16, buffers, 2);
27
+  ostgl_make_current(this->context, 0); 
28
+}
29
+
30
+BGLView::~BGLView()
31
+{
32
+  ostgl_delete_context(this->context);
33
+  delete this->bitmaps[0];
34
+  delete this->bitmaps[1];
35
+}
36
+
37
+void 
38
+BGLView::LockGL()
39
+{  
40
+  BGLView::locker.Lock();
41
+  ostgl_make_current(this->context, this->currBitmap);
42
+}
43
+
44
+void 
45
+BGLView::UnlockGL()
46
+{
47
+  BGLView::locker.Unlock();
48
+}
49
+
50
+void 
51
+BGLView::SwapBuffers()
52
+{
53
+  if (Window()->Lock()) {
54
+    DrawBitmap(this->bitmaps[this->currBitmap]);
55
+    Window()->Unlock();
56
+    this->currBitmap ^= 1;
57
+  }
58
+}
59
+
60
+/*
61
+BView *
62
+BGLView::EmbeddedView()
63
+{
64
+  return NULL;
65
+}
66
+
67
+status_t 
68
+BGLView::CopyPixelsOut(BPoint source, BBitmap *dest)
69
+{
70
+  assert(0);
71
+  return 0;
72
+}
73
+
74
+status_t 
75
+BGLView::CopyPixelsIn(BBitmap *source, BPoint dest)
76
+{
77
+  assert(0);
78
+  return 0;
79
+}
80
+*/
81
+
82
+void 
83
+BGLView::ErrorCallback(GLenum /*errorCode*/)
84
+{
85
+}
86
+
87
+void 
88
+BGLView::Draw(BRect rect)
89
+{
90
+  //fprintf(stderr, "GLView::Draw()");
91
+  DrawBitmap(this->bitmaps[this->currBitmap^1], rect, rect);
92
+}
93
+
94
+void 
95
+BGLView::AttachedToWindow()
96
+{
97
+}
98
+
99
+void 
100
+BGLView::AllAttached()
101
+{
102
+}
103
+
104
+void 
105
+BGLView::DetachedFromWindow()
106
+{
107
+}
108
+
109
+void 
110
+BGLView::AllDetached()
111
+{
112
+}
113
+
114
+void 
115
+BGLView::FrameResized(float w, float h)
116
+{
117
+  delete this->bitmaps[0];
118
+  delete this->bitmaps[1];
119
+#ifdef __INTEL__
120
+  color_space cs = B_RGB16_LITTLE;
121
+#else
122
+  color_space cs = B_RGB16_BIG;
123
+#endif
124
+  this->bitmaps[0] = new BBitmap(BRect(0,0, w-1, h-1), 
125
+                                 cs, false, true);
126
+  this->bitmaps[1] = new BBitmap(BRect(0,0, w-1, h-1), 
127
+                                 cs, false, true);
128
+  int w2 = this->bitmaps[0]->BytesPerRow() / 2;
129
+  void *buffers[2];
130
+  buffers[0] = this->bitmaps[0]->Bits();
131
+  buffers[1] = this->bitmaps[1]->Bits();
132
+  ostgl_resize(this->context, w2, h, buffers);
133
+}
134
+
135
+/*
136
+status_t 
137
+BGLView::Perform(perform_code d, void *arg)
138
+{
139
+  
140
+}
141
+*/
142
+
143
+//
144
+// the rest are pass-through functions
145
+//
146
+
147
+status_t 
148
+BGLView::Archive(BMessage *data, bool deep) const
149
+{
150
+  return BView::Archive(data, deep);
151
+}
152
+
153
+void 
154
+BGLView::MessageReceived(BMessage *msg)
155
+{
156
+  BView::MessageReceived(msg);
157
+}
158
+
159
+void 
160
+BGLView::SetResizingMode(uint32 mode)
161
+{
162
+  BView::SetResizingMode(mode);
163
+}
164
+
165
+void 
166
+BGLView::Show()
167
+{
168
+  BView::Show();
169
+}
170
+
171
+void 
172
+BGLView::Hide()
173
+{
174
+  BView::Hide();
175
+}
176
+
177
+BHandler *
178
+BGLView::ResolveSpecifier(BMessage *msg, int32 index,
179
+                          BMessage *specifier, int32 form,
180
+					      const char *property)
181
+{
182
+  return BView::ResolveSpecifier(msg, index, specifier, form, property);
183
+}
184
+
185
+status_t 
186
+BGLView::GetSupportedSuites(BMessage *data)
187
+{
188
+  return BView::GetSupportedSuites(data);
189
+}
190
+
191
+/*
192
+void 
193
+BGLView::DirectConnected( direct_buffer_info *info )
194
+{
195
+  BView::DirectConnected(info);
196
+}
197
+*/
198
+
199
+/*
200
+void 
201
+BGLView::EnableDirectMode( bool enabled )
202
+{
203
+  BView::EnableDirectMode(enabled);
204
+}
205
+*/

+ 72 - 0
3rdparty/tinygl-0.4-ugfx/BeOS/GLView.h

@@ -0,0 +1,72 @@
1
+#ifndef _glview_h_
2
+#define _glview_h_
3
+
4
+#define BGL_RGB           0
5
+#define BGL_INDEX         1
6
+#define BGL_SINGLE        0
7
+#define BGL_DOUBLE        2
8
+#define BGL_DIRECT        0
9
+#define BGL_INDIRECT      4
10
+#define BGL_ACCUM         8
11
+#define BGL_ALPHA        16
12
+#define BGL_DEPTH        32
13
+#define BGL_OVERLAY      64
14
+#define BGL_UNDERLAY    128
15
+#define BGL_STENCIL     512
16
+
17
+#include <interface/View.h>
18
+#include <support/Locker.h>
19
+#include <GL/gl.h>
20
+#include <GL/oscontext.h>
21
+#include <game/WindowScreen.h>
22
+#include <game/DirectWindow.h>
23
+
24
+class BGLView : public BView {
25
+public:
26
+  BGLView(BRect rect, char *name,
27
+          ulong resizingMode, ulong mode,
28
+          ulong options);
29
+  virtual ~BGLView();
30
+
31
+  void LockGL();
32
+  void UnlockGL();
33
+  void SwapBuffers();
34
+//  BView *EmbeddedView();
35
+//  status_t CopyPixelsOut(BPoint source, BBitmap *dest);
36
+//  status_t CopyPixelsIn(BBitmap *source, BPoint dest);
37
+
38
+  virtual void ErrorCallback(GLenum errorCode);
39
+  virtual void Draw(BRect updateRect);
40
+  virtual void AttachedToWindow();
41
+  virtual void AllAttached();
42
+  virtual void DetachedFromWindow();
43
+  virtual void AllDetached();
44
+  virtual void FrameResized(float width, float height);
45
+//  virtual status_t Perform(perform_code d, void *arg);
46
+
47
+  //
48
+  // Methods below are pass-throughs to BView for the moment.
49
+  //
50
+  
51
+  virtual status_t Archive(BMessage *data, bool deep = true) const;
52
+  virtual void MessageReceived(BMessage *msg);
53
+  virtual void SetResizingMode(uint32 mode);
54
+
55
+  virtual void Show();
56
+  virtual void Hide();
57
+
58
+  virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
59
+							         BMessage *specifier, int32 form,
60
+							         const char *property);
61
+  virtual status_t GetSupportedSuites(BMessage *data);
62
+  //void DirectConnected( direct_buffer_info *info );
63
+  //void EnableDirectMode( bool enabled );
64
+
65
+private:
66
+  ostgl_context *context;
67
+  BBitmap *bitmaps[2];
68
+  int currBitmap;
69
+  static BLocker locker;
70
+};
71
+
72
+#endif // _glview_h_

+ 16 - 0
3rdparty/tinygl-0.4-ugfx/BeOS/Makefile

@@ -0,0 +1,16 @@
1
+OBJS=GLView.o 
2
+INCLUDES = -I../include
3
+LIB = libGLView.a
4
+
5
+all: $(LIB)
6
+
7
+$(LIB): $(OBJS)
8
+	rm -f $(LIB)
9
+	ar rcs $(LIB) $(OBJS)
10
+	cp $(LIB) ../lib
11
+
12
+clean:
13
+	rm -f *~ *.o *.a
14
+
15
+GLView.o: GLView.cpp GLView.h
16
+	$(CC) $(CFLAGS) $(INCLUDES) -c GLView.cpp

+ 38 - 0
3rdparty/tinygl-0.4-ugfx/Changelog

@@ -0,0 +1,38 @@
1
+version 0.4: 
2
+ - added 24/32 bit rendering support (Olivier Landemarre - F. Bellard)
3
+ - fixed GL_TRIANGLE_STRIP (Olivier Landemarre)
4
+ - added gl_malloc, gl_free, gl_zalloc wrappers (Olivier Landemarre)
5
+
6
+version 0.3:
7
+ - added NanoX API (nglx) (F. Bellard)
8
+ - added gears example and unified GUI in examples (F. Bellard)
9
+ - added TGL_FEATURE_RENDER_BITS so that it will be possible to render
10
+   natively in 15/16/24 or 32 bits. (F. Bellard)
11
+ - interpolated lines (Olivier Landemarre)
12
+ - fast no shading case (Olivier Landemarre)
13
+ - fast no projection case (Olivier Landemarre)
14
+
15
+version 0.2: Fabrice Bellard
16
+ - added 24/32 bpp support. Added some features.h ifdefs.
17
+ - fixed some error reporting cases in the examples
18
+ - endianness is deduced from the glibc (BYTE_ORDER macro)
19
+
20
+version 0.19: Peder Blekken 
21
+ - new files BeOS/* src/msghandling.*, src/arrays.*, src/oscontext.c
22
+     include/GL/oscontext.h src/features.h
23
+ - added support for BeOS, see README.BEOS
24
+ - added support for drawing convex polygons with unlimited # of vertices
25
+ - added support for GL_LIGHT_MODEL_TWO_SIDE
26
+ - added generic rotation code for glopRotate
27
+ - added support for opengl 1.1 arrays
28
+ - added support for glPolygonOffset, not implemented.
29
+ - added glGetFloatv, limited support.
30
+ - added some pnames for glGetIntegerv
31
+ - added some empty functions in include/GL/gl.h to compile VRMLView
32
+ - added GL_VERSION_1_1 define in include/GL/gl.h    
33
+ - fixed "bug" when context->gl_resize_viewport is not set.
34
+ - fixed bug in glBindTexture (didn't accept texture object 0)
35
+
36
+version 0.1:
37
+ - Initial revision, Fabrice Bellard
38
+

+ 10 - 0
3rdparty/tinygl-0.4-ugfx/INSTALL

@@ -0,0 +1,10 @@
1
+Installation:
2
+
3
+- Edit config.mk and change what is needed. You can also look at
4
+src/zfeatures.h to change very specific details (only useful to tune
5
+TinyGL to your needs). You can link the examples with either OpenGL,
6
+Mesa or TinyGL.
7
+
8
+- Type 'make'. The library 'libTinyGL.a' is copied into './lib'. The
9
+examples are build in './examples'. Only the directories './lib' and
10
+'./include' are needed to use TinyGL from another program.

+ 22 - 0
3rdparty/tinygl-0.4-ugfx/LICENCE

@@ -0,0 +1,22 @@
1
+Copyright notice:
2
+
3
+ (C) 1997-1998 Fabrice Bellard
4
+
5
+  This software is provided 'as-is', without any express or implied
6
+  warranty.  In no event will the authors be held liable for any damages
7
+  arising from the use of this software.
8
+
9
+  Permission is granted to anyone to use this software for any purpose,
10
+  including commercial applications, and to alter it and redistribute it
11
+  freely, subject to the following restrictions:
12
+
13
+  1. The origin of this software must not be misrepresented; you must not
14
+     claim that you wrote the original software. If you use this software
15
+     in a product, an acknowledgment in the product and its documentation 
16
+     *is* required.
17
+  2. Altered source versions must be plainly marked as such, and must not be
18
+     misrepresented as being the original software.
19
+  3. This notice may not be removed or altered from any source distribution.
20
+
21
+If you redistribute modified sources, I would appreciate that you
22
+include in the files history information documenting your changes.

+ 206 - 0
3rdparty/tinygl-0.4-ugfx/LIMITATIONS

@@ -0,0 +1,206 @@
1
+
2
+Here are listed the functions that TinyGL understands with the known
3
+limitations. The non mentionned functions are *not* implemented and
4
+must not be used.
5
+
6
+
7
+************ glEnable / glDisable
8
+
9
+- The following flags are handled:
10
+
11
+GL_CULL_FACE, GL_LIGHTING, GL_COLOR_MATERIAL, GL_TEXTURE_2D, GL_NORMALIZE,
12
+GL_LIGHTx, GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_POINT,
13
+GL_POLYGON_OFFSET_LINE
14
+
15
+
16
+- GL_DEPTH_TEST is accepted, but it is only used for lines. For all
17
+  other primitives, Z buffer use is assumed.  The DepthMode is
18
+  hardcoded as GL_LESS (OpenGL default).
19
+
20
+************ glShadeModel
21
+
22
+OK.
23
+
24
+************ glCullFace
25
+
26
+OK.
27
+
28
+************ glPolygonMode
29
+
30
+OK.
31
+
32
+************ glBegin
33
+
34
+No tests are performed to prevent some functions of being executed
35
+between glBegin/glEnd.
36
+
37
+************ glEnd
38
+
39
+OK.
40
+
41
+************ glVertex
42
+
43
+Some prototypes are not implemented.
44
+
45
+
46
+************ glColor
47
+
48
+Some prototypes are not implemented.
49
+
50
+************ glNormal
51
+
52
+Some prototypes are not implemented.
53
+
54
+************ glTexCoord
55
+
56
+- Some prototypes are not implemented.
57
+
58
+- The Matrix transformation is not applied yet.
59
+
60
+************ glEdgeFlag
61
+
62
+OK. The edge handling has to be tested, although it is not much useful
63
+in TinyGL.
64
+
65
+************ glMatrixMode / glLoadMatrixf / glLoadIdentity / glMultMatrixf /
66
+             glPushMatrix / glPopMatrix / glRotatef / glTranslatef / glScalef /
67
+             glFrustum
68
+
69
+- The prototypes with doubles are not implemented.
70
+
71
+************ glViewport
72
+
73
+GlViewport calls a function pointers to tell glx (or another display
74
+system) to resize the Z buffer and the ximage. Made optional in
75
+version 0.2.
76
+
77
+************ glGenLists / glIsList / glNewList / glEndList / glCallList
78
+
79
+OK.
80
+
81
+************ glClear / glClearColor / glClearDepth
82
+
83
+The whole zbuffer and the colors are cleared in any case. The clear color
84
+can be redefined, by *not* the initial z value.
85
+
86
+************ glRenderMode
87
+
88
+Only the modes GL_RENDER and GL_SELECT are implemented.
89
+
90
+************ glSelectBuffer / glInitNames / glPushName / glPopName / glLoadName
91
+
92
+OK.
93
+
94
+************ glGenTextures / glDeleteTextures / glBindTexture 
95
+
96
+OK. These functions should be used to get the maximum performance with
97
+TinyGL. 
98
+
99
+************ glTexImage2D
100
+
101
+The function accepts only RGB UNSIGNED_BYTES bitmaps. They are
102
+internally resized to 256x256 so you'd better use that size. No
103
+mipmapping is implemented although it will come if asked. No borders
104
+are implemented.
105
+
106
+************ glTexEnvi
107
+
108
+The only supported mode is GL_DECAL, although others are planned if
109
+asked.
110
+
111
+
112
+************ glTexParameteri
113
+
114
+The other prototypes are not implemented. Only the follwing mode are
115
+implemented:
116
+
117
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
118
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
119
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
120
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
121
+
122
+************ glPixelStorei
123
+
124
+The pixels are alware byte aligned.
125
+
126
+************ glMaterialfv / glMaterialf / glColorMaterial
127
+
128
+OK.
129
+
130
+
131
+************ glLightfv / glLightf / glLightModeli / glLightModelfv
132
+
133
+OK. The OpenGL lightening is implemented but not optimized.
134
+
135
+
136
+************ glFlush
137
+
138
+Ignored.
139
+
140
+************ glHint
141
+
142
+Ignored.
143
+
144
+************ glGetIntegerv
145
+
146
+- only GL_VIEWPORT, GL_MAX_MODELVIEW_STACK_DEPTH, 
147
+GL_MAX_PROJECTION_STACK_DEPTH, GL_MAX_LIGHTS, GL_MAX_TEXTURE_SIZE,
148
+GL_MAX_TEXTURE_STACK_DEPTH
149
+
150
+************ glGetIntegerv
151
+
152
+- only GL_TEXTURE_MATRIX, GL_PROJECTION_MATRIX, GL_MODELVIEW_MATRIX,
153
+GL_LINE_WIDTH, GL_LINE_WIDTH_RANGE, GL_POINT_SIZE, GL_POINT_SIZE_RANGE
154
+
155
+************ glPolygonOffset
156
+
157
+- only API implemented.
158
+
159
+************ glEnableClientState, glDisableClientState,
160
+             
161
+- No support for GL_INDEX_ARRAY_POINTER or GL_EDGE_FLAG_ARRAY_POINTER
162
+
163
+************ glVertexPointer, glNormalPointer, 
164
+             glColorPointer, glTexureCoordPointer
165
+
166
+- OK
167
+
168
+------------------------------------------------------------------------------
169
+
170
+TinyGL GLX emulation:
171
+
172
+
173
+************ glXQueryExtension
174
+
175
+Returns always True
176
+
177
+************ glXChooseVisual
178
+
179
+Only 8 bit Pseudocolor or 16 bit Truecolor Visual are accepted. The
180
+attribute list is ignored.
181
+
182
+************ glXCreateContext
183
+
184
+The sharing is not implemented although the code could handle it.
185
+
186
+************ glXDestroyContext
187
+
188
+OK.
189
+
190
+************ glXMakeCurrent
191
+
192
+Not all the syntax is supported yet, in particular with the 'NULL' or
193
+'None' parameters.
194
+
195
+
196
+************ glXSwapBuffers
197
+
198
+OK.
199
+
200
+************ glXWaitGL / glXWaitX
201
+
202
+Ignored.
203
+
204
+
205
+See README.BEOS for BeOS limitations.
206
+

+ 15 - 0
3rdparty/tinygl-0.4-ugfx/Makefile

@@ -0,0 +1,15 @@
1
+include config.mk
2
+
3
+all:
4
+	( for f in $(DIRS); do ( cd $$f ; make all ) || exit 1 ; done )
5
+
6
+clean:
7
+	rm -f *~ lib/libTinyGL.a include/GL/*~ TAGS
8
+	( for f in $(DIRS); do ( cd $$f ; make clean ; ) done )
9
+
10
+install:
11
+	( for f in $(DIRS); do ( cd $$f ; make install ; ) done )
12
+
13
+
14
+tar:
15
+	( cd .. ; tar zcvf TinyGL-0.4.tar.gz TinyGL --exclude CVS --exclude TAGS )

+ 150 - 0
3rdparty/tinygl-0.4-ugfx/README

@@ -0,0 +1,150 @@
1
+TinyGL 0.4 (c) 1997-2002 Fabrice Bellard.
2
+
3
+General Description:
4
+--------------------
5
+
6
+TinyGL is intended to be a very small implementation of a subset of
7
+OpenGL* for embedded systems or games. It is a software only
8
+implementation. Only the main OpenGL calls are implemented. All the
9
+calls I considered not important are simply *not implemented*.
10
+
11
+The main strength of TinyGL is that it is fast and simple because it
12
+has not to be exactly compatible with OpenGL. In particular, the
13
+texture mapping and the geometrical transformations are very fast.
14
+
15
+The main features of TinyGL are:
16
+
17
+- Header compatible with OpenGL (the headers are adapted from the very good
18
+Mesa by Brian Paul et al.)
19
+
20
+- Zlib-like licence for easy integration in commercial designs (read
21
+the LICENCE file).
22
+
23
+- Subset of GLX for easy testing with X Window. 
24
+
25
+- GLX like API (NGLX) to use it with NanoX in MicroWindows/NanoX.
26
+
27
+- Subset of BGLView under BeOS.
28
+
29
+- OpenGL like lightening.
30
+
31
+- Complete OpenGL selection mode handling for object picking.
32
+
33
+- 16 bit Z buffer. 16/24/32 bit RGB rendering. High speed dithering to
34
+paletted 8 bits if needed. High speed conversion to 24 bit packed
35
+pixel or 32 bit RGBA if needed.
36
+
37
+- Fast Gouraud shadding optimized for 16 bit RGB.
38
+
39
+- Fast texture mapping capabilities, with perspective correction and
40
+texture objects.
41
+
42
+- 32 bit float only arithmetic.
43
+
44
+- Very small: compiled code size of about 40 kB on x86. The file
45
+  src/zfeatures.h can be used to remove some unused features from
46
+  TinyGL.
47
+
48
+- C sources for GCC on 32/64 bit architectures. It has been tested
49
+succesfully on x86-Linux and sparc-Solaris.
50
+
51
+Examples:
52
+---------
53
+
54
+I took three simple examples from the Mesa package to test the main
55
+functions of TinyGL. You can link them to either TinyGL, Mesa or any
56
+other OpenGL/GLX implementation. You can also compile them with
57
+Microwindows.
58
+
59
+- texobj illustrates the use of texture objects. Its shows the speed
60
+of TinyGL in this case.
61
+
62
+- glutmech comes from the GLUT packages. It is much bigger and slower
63
+because it uses the lightening. I have just included some GLU
64
+functions and suppressed the GLUT related code to make it work. It
65
+shows the display list handling of TinyGL in particular. You can look
66
+at the source code to learn the keys to move the robot. The key 't'
67
+toggles between shaded rendering and wire frame.
68
+
69
+- You can download and compile the VReng project to see that TinyGL
70
+has been successfully used in a big project
71
+(http://www-inf.enst.fr/vreng).
72
+
73
+Architecture:
74
+-------------
75
+
76
+TinyGL is made up four main modules:
77
+
78
+- Mathematical routines (zmath).
79
+
80
+- OpenGL-like emulation (zgl).
81
+
82
+- Z buffer and rasterisation (zbuffer).
83
+
84
+- GLX interface (zglx).
85
+
86
+To use TinyGL in an embedded system, you should look at the GLX layer
87
+and modify it to suit your need. Adding a more user friendly
88
+developper layer (as in Mesa) may be useful.
89
+
90
+Notes - limitations:
91
+--------------------
92
+
93
+- See the file 'LIMITATIONS' to see the current functions supported by the API.
94
+
95
+- The multithreading could be easily implemented since no global state
96
+is maintainted. The library gets the current context with a function
97
+which can be modified.
98
+
99
+- The lightening is not very fast. I supposed that in most games the
100
+lightening is computed by the 3D engine.
101
+
102
+- Some changes are needed for 64 bit pointers for the handling of
103
+arrays of float with the GLParam union.
104
+
105
+- List sharing is partialy supported in the source, but not by the
106
+current TinyGLX implementation (is it really useful ?).
107
+
108
+- No user clipping planes are supported.
109
+
110
+- No color index mode (no longer useful !)
111
+
112
+- The mipmapping is not implemented.
113
+
114
+- The perspecture correction in the mapping code does not use W but
115
+1/Z. In any 'normal scene' it should work.
116
+
117
+- The resizing of the viewport in TinyGLX ensures that the width and
118
+the height are multiples of 4. This is not optimal because some pixels
119
+of the window may not be refreshed.
120
+
121
+Why ?
122
+-----
123
+
124
+TinyGL was developped as a student project for a Virtual Reality
125
+network system called VReng (see the VReng home page at
126
+http://www-inf.enst.fr/vreng).
127
+
128
+At that time (January 1997), my initial project was to write my own 3D
129
+rasterizer based on some old sources I wrote. But I realized that it
130
+would be better to use OpenGL to work on any platform. My problem was
131
+that I wanted to use texture mapping which was (and is still) quite
132
+slower on many software OpenGL implementation. I could have modified
133
+Mesa to suit my needs, but I really wanted to use my old sources for
134
+that project. 
135
+
136
+I finally decided to use the same syntax as OpenGL but with my own
137
+libraries, thinking that later it could ease the porting of VReng to
138
+OpenGL.
139
+
140
+Now VReng is at last compatible with OpenGL, and I managed to patch
141
+TinyGL so that VReng can still work with it without any modifications.
142
+
143
+Since TinyGL may be useful for some people, especially in the world of
144
+embedded designs, I decided to release it 'as is', otherwise, it would
145
+have been lost on my hard disk !
146
+
147
+------------------------------------------------------------------------------
148
+* OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
149
+------------------------------------------------------------------------------
150
+Fabrice Bellard.

+ 20 - 0
3rdparty/tinygl-0.4-ugfx/README.BEOS

@@ -0,0 +1,20 @@
1
+BeOS support for TinyGL, 1998 Peder Blekken
2
+
3
+I implemented (a limited version of) the BGLView class. There is 
4
+no DirectWindow support, and some other funtions are missing too,
5
+but it should work ok for most uses. Feel free to use and modify 
6
+GLView.cpp and GLView.h in any way you desire.
7
+
8
+You will need to take a look in Makefile to compile the library
9
+under BeOS. For those of you not familiar with using makefiles: too bad :)
10
+
11
+Also, you will probably need to remove  /boot/develop/headers/be/opengl 
12
+from the BEINCLUDES environment variable. Unfortunately, this means 
13
+editing the /boot/beos/system/boot/SetupEnvironment. It might be possible 
14
+to just make sure the TinyGL path is before Be's  OpenGL in the include-paths 
15
+though. But I prefer to remove /boot/develop/headers/be/opengl, since I 
16
+often use Mesa as well. It is a better to add the OpenGL include path in your 
17
+makefile; or BeIDE project if that is what you use.
18
+
19
+Contact me for any reason: <pederb@sim.no>
20
+

+ 4 - 0
3rdparty/tinygl-0.4-ugfx/README.uGFX

@@ -0,0 +1,4 @@
1
+uGFX support for TinyGL, 2014 Andrew Hannam
2
+
3
+Some files have been modified to remove references to non-embedded
4
+functions such as fprintf, exit and assert.

+ 82 - 0
3rdparty/tinygl-0.4-ugfx/config.mk

@@ -0,0 +1,82 @@
1
+#####################################################################
2
+# C compiler
3
+
4
+# linux
5
+CC= gcc
6
+CFLAGS= -g -Wall -O2
7
+LFLAGS=
8
+
9
+# for BeOS PPC
10
+#CC= mwcc
11
+#CFLAGS= -I. -i-
12
+#LFLAGS=
13
+
14
+#####################################################################
15
+# TinyGL configuration 
16
+
17
+#####################################################################
18
+# Select window API for TinyGL: 
19
+
20
+# standard X11 GLX like API 
21
+TINYGL_USE_GLX=y
22
+
23
+# BEOS API
24
+#TINYGL_USE_BEOS=y
25
+
26
+# Micro Windows NanoX API
27
+#TINYGL_USE_NANOX=y
28
+
29
+#####################################################################
30
+# X11 configuration (for the examples only)
31
+
32
+ifdef TINYGL_USE_GLX
33
+# Linux
34
+UI_LIBS= -L/usr/X11R6/lib -lX11 -lXext
35
+UI_INCLUDES= 
36
+# Solaris
37
+#UI_LIBS= -L/usr/X11/lib -lX11 -lXext -lsocket -lnsl
38
+#UI_INCLUDES= 
39
+
40
+UI_OBJS=x11.o
41
+endif
42
+
43
+#####################################################################
44
+# Micro windowX11 configuration (for the examples only)
45
+
46
+ifdef TINYGL_USE_NANOX
47
+UI_LIBS= -lnano-X -lmwengine -lmwdrivers -lmwfonts
48
+UI_INCLUDES=
49
+
50
+# X11 target for nanoX
51
+UI_LIBS+= -L/usr/X11R6/lib -lX11 -lXext
52
+
53
+UI_OBJS=nanox.o
54
+endif
55
+
56
+#####################################################################
57
+# OpenGL configuration (for the examples only)
58
+
59
+# use TinyGL 
60
+GL_LIBS= -L../lib -lTinyGL 
61
+GL_INCLUDES= -I../include
62
+GL_DEPS= ../lib/libTinyGL.a
63
+
64
+# use Mesa
65
+#GL_LIBS= -lMesaGL 
66
+#GL_INCLUDES= 
67
+#GL_DEPS=
68
+
69
+# use OpenGL
70
+#GL_LIBS= -lGL 
71
+#GL_INCLUDES= 
72
+#GL_DEPS=
73
+
74
+####################################################################
75
+# Compile and link control
76
+
77
+# UNIX systems
78
+DIRS= src examples
79
+
80
+# BeOS
81
+# DIRS= src BeOS
82
+

+ 29 - 0
3rdparty/tinygl-0.4-ugfx/examples/Makefile

@@ -0,0 +1,29 @@
1
+include ../config.mk
2
+
3
+PROGS = mech texobj gears spin
4
+
5
+all: $(PROGS)
6
+
7
+clean:
8
+	rm -f core *.o *~ $(PROGS)
9
+
10
+mech: mech.o glu.o $(UI_OBJS) $(GL_DEPS)
11
+	$(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm
12
+
13
+texobj: texobj.o $(UI_OBJS) $(GL_DEPS)
14
+	$(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm
15
+
16
+gears: gears.o $(UI_OBJS) $(GL_DEPS)
17
+	$(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm
18
+
19
+spin: spin.o $(UI_OBJS) $(GL_DEPS)
20
+	$(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm
21
+
22
+.c.o:
23
+	$(CC)	$(CFLAGS) $(GL_INCLUDES) $(UI_INCLUDES) -c $*.c
24
+
25
+mech.o: glu.h 
26
+
27
+glu.o: glu.h
28
+
29
+ui.o: ui.h

+ 300 - 0
3rdparty/tinygl-0.4-ugfx/examples/gears.c

@@ -0,0 +1,300 @@
1
+/* gears.c */
2
+
3
+/*
4
+ * 3-D gear wheels.  This program is in the public domain.
5
+ *
6
+ * Brian Paul
7
+ */
8
+
9
+
10
+#include <math.h>
11
+#include <stdlib.h>
12
+#include <stdio.h>
13
+#include <string.h>
14
+
15
+#include <GL/glx.h> 
16
+#include <GL/gl.h> 
17
+#include "ui.h"
18
+
19
+#ifndef M_PI
20
+#  define M_PI 3.14159265
21
+#endif
22
+
23
+
24
+/*
25
+ * Draw a gear wheel.  You'll probably want to call this function when
26
+ * building a display list since we do a lot of trig here.
27
+ *
28
+ * Input:  inner_radius - radius of hole at center
29
+ *         outer_radius - radius at center of teeth
30
+ *         width - width of gear
31
+ *         teeth - number of teeth
32
+ *         tooth_depth - depth of tooth
33
+ */
34
+static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
35
+		  GLint teeth, GLfloat tooth_depth )
36
+{
37
+   GLint i;
38
+   GLfloat r0, r1, r2;
39
+   GLfloat angle, da;
40
+   GLfloat u, v, len;
41
+
42
+   r0 = inner_radius;
43
+   r1 = outer_radius - tooth_depth/2.0;
44
+   r2 = outer_radius + tooth_depth/2.0;
45
+
46
+   da = 2.0*M_PI / teeth / 4.0;
47
+
48
+   glShadeModel( GL_FLAT );
49
+
50
+   glNormal3f( 0.0, 0.0, 1.0 );
51
+
52
+   /* draw front face */
53
+   glBegin( GL_QUAD_STRIP );
54
+   for (i=0;i<=teeth;i++) {
55
+      angle = i * 2.0*M_PI / teeth;
56
+      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
57
+      glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
58
+      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
59
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
60
+   }
61
+   glEnd();
62
+
63
+   /* draw front sides of teeth */
64
+   glBegin( GL_QUADS );
65
+   da = 2.0*M_PI / teeth / 4.0;
66
+   for (i=0;i<teeth;i++) {
67
+      angle = i * 2.0*M_PI / teeth;
68
+
69
+      glVertex3f( r1*cos(angle),      r1*sin(angle),      width*0.5 );
70
+      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   width*0.5 );
71
+      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
72
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
73
+   }
74
+   glEnd();
75
+
76
+
77
+   glNormal3f( 0.0, 0.0, -1.0 );
78
+
79
+   /* draw back face */
80
+   glBegin( GL_QUAD_STRIP );
81
+   for (i=0;i<=teeth;i++) {
82
+      angle = i * 2.0*M_PI / teeth;
83
+      glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
84
+      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
85
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
86
+      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
87
+   }
88
+   glEnd();
89
+
90
+   /* draw back sides of teeth */
91
+   glBegin( GL_QUADS );
92
+   da = 2.0*M_PI / teeth / 4.0;
93
+   for (i=0;i<teeth;i++) {
94
+      angle = i * 2.0*M_PI / teeth;
95
+
96
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
97
+      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
98
+      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
99
+      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
100
+   }
101
+   glEnd();
102
+
103
+
104
+   /* draw outward faces of teeth */
105
+   glBegin( GL_QUAD_STRIP );
106
+   for (i=0;i<teeth;i++) {
107
+      angle = i * 2.0*M_PI / teeth;
108
+
109
+      glVertex3f( r1*cos(angle),      r1*sin(angle),       width*0.5 );
110
+      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
111
+      u = r2*cos(angle+da) - r1*cos(angle);
112
+      v = r2*sin(angle+da) - r1*sin(angle);
113
+      len = sqrt( u*u + v*v );
114
+      u /= len;
115
+      v /= len;
116
+      glNormal3f( v, -u, 0.0 );
117
+      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),    width*0.5 );
118
+      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
119
+      glNormal3f( cos(angle), sin(angle), 0.0 );
120
+      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da),  width*0.5 );
121
+      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
122
+      u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
123
+      v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
124
+      glNormal3f( v, -u, 0.0 );
125
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da),  width*0.5 );
126
+      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
127
+      glNormal3f( cos(angle), sin(angle), 0.0 );
128
+   }
129
+
130
+   glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
131
+   glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
132
+
133
+   glEnd();
134
+
135
+
136
+   glShadeModel( GL_SMOOTH );
137
+
138
+   /* draw inside radius cylinder */
139
+   glBegin( GL_QUAD_STRIP );
140
+   for (i=0;i<=teeth;i++) {
141
+      angle = i * 2.0*M_PI / teeth;
142
+      glNormal3f( -cos(angle), -sin(angle), 0.0 );
143
+      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
144
+      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
145
+   }
146
+   glEnd();
147
+      
148
+}
149
+
150
+
151
+static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
152
+static GLint gear1, gear2, gear3;
153
+static GLfloat angle = 0.0;
154
+
155
+static GLuint limit;
156
+static GLuint count = 1;
157
+
158
+
159
+void draw( void )
160
+{
161
+   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
162
+
163
+   glPushMatrix();
164
+   glRotatef( view_rotx, 1.0, 0.0, 0.0 );
165
+   glRotatef( view_roty, 0.0, 1.0, 0.0 );
166
+   glRotatef( view_rotz, 0.0, 0.0, 1.0 );
167
+
168
+   glPushMatrix();
169
+   glTranslatef( -3.0, -2.0, 0.0 );
170
+   glRotatef( angle, 0.0, 0.0, 1.0 );
171
+   glCallList(gear1);
172
+   glPopMatrix();
173
+
174
+   glPushMatrix();
175
+   glTranslatef( 3.1, -2.0, 0.0 );
176
+   glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
177
+   glCallList(gear2);
178
+   glPopMatrix();
179
+
180
+   glPushMatrix();
181
+   glTranslatef( -3.1, 4.2, 0.0 );
182
+   glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
183
+   glCallList(gear3);
184
+   glPopMatrix();
185
+
186
+   glPopMatrix();
187
+
188
+   tkSwapBuffers();
189
+
190
+   count++;
191
+   if (count==limit) {
192
+       exit(0);
193
+   }
194
+}
195
+
196
+
197
+
198
+void idle( void )
199
+{
200
+   angle += 2.0;
201
+   draw();
202
+}
203
+
204
+
205
+
206
+/* change view angle, exit upon ESC */
207
+GLenum key(int k, GLenum mask)
208
+{
209
+   switch (k) {
210
+      case KEY_UP:
211
+         view_rotx += 5.0;
212
+	 return GL_TRUE;
213
+      case KEY_DOWN:
214
+         view_rotx -= 5.0;
215
+	 return GL_TRUE;
216
+      case KEY_LEFT:
217
+         view_roty += 5.0;
218
+	 return GL_TRUE;
219
+      case KEY_RIGHT:
220
+         view_roty -= 5.0;
221
+	 return GL_TRUE;
222
+      case 'z':
223
+	 view_rotz += 5.0;
224
+	 return GL_TRUE;
225
+      case 'Z':
226
+	 view_rotz -= 5.0;
227
+	 return GL_TRUE;
228
+      case KEY_ESCAPE:
229
+          exit(0);
230
+   }
231
+   return GL_FALSE;
232
+}
233
+
234
+
235
+
236
+/* new window size or exposure */
237
+void reshape( int width, int height )
238
+{
239
+   GLfloat  h = (GLfloat) height / (GLfloat) width;
240
+
241
+   glViewport(0, 0, (GLint)width, (GLint)height);
242
+   glMatrixMode(GL_PROJECTION);
243
+   glLoadIdentity();
244
+   glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
245
+   glMatrixMode(GL_MODELVIEW);
246
+   glLoadIdentity();
247
+   glTranslatef( 0.0, 0.0, -40.0 );
248
+   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
249
+}
250
+
251
+
252
+void init( void )
253
+{
254
+   static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
255
+   static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
256
+   static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
257
+   static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
258
+
259
+   glLightfv( GL_LIGHT0, GL_POSITION, pos );
260
+   glEnable( GL_CULL_FACE );
261
+   glEnable( GL_LIGHTING );
262
+   glEnable( GL_LIGHT0 );
263
+   glEnable( GL_DEPTH_TEST );
264
+
265
+   /* make the gears */
266
+   gear1 = glGenLists(1);
267
+   glNewList(gear1, GL_COMPILE);
268
+   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
269
+   gear( 1.0, 4.0, 1.0, 20, 0.7 );
270
+   glEndList();
271
+
272
+   gear2 = glGenLists(1);
273
+   glNewList(gear2, GL_COMPILE);
274
+   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
275
+   gear( 0.5, 2.0, 2.0, 10, 0.7 );
276
+   glEndList();
277
+
278
+   gear3 = glGenLists(1);
279
+   glNewList(gear3, GL_COMPILE);
280
+   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
281
+   gear( 1.3, 2.0, 0.5, 10, 0.7 );
282
+   glEndList();
283
+
284
+   glEnable( GL_NORMALIZE );
285
+}
286
+
287
+int main(int argc, char **argv) 
288
+{
289
+   if (argc>1) {
290
+      /* do 'n' frames then exit */
291
+      limit = atoi( argv[1] ) + 1;
292
+   }
293
+   else {
294
+      limit = 0;
295
+   }
296
+
297
+   return ui_loop(argc, argv, "gears");
298
+}
299
+
300
+

+ 261 - 0
3rdparty/tinygl-0.4-ugfx/examples/glu.c

@@ -0,0 +1,261 @@
1
+#include <stdlib.h>
2
+#include <math.h>
3
+#include <GL/gl.h>
4
+#include "glu.h"
5
+
6
+
7
+void drawTorus(float rc, int numc, float rt, int numt)
8
+{
9
+    int i, j, k;
10
+    double s, t;
11
+    double x, y, z;
12
+    double pi, twopi;
13
+
14
+    pi = 3.14159265358979323846;
15
+    twopi = 2 * pi;
16
+ 
17
+    for (i = 0; i < numc; i++) {
18
+	glBegin(GL_QUAD_STRIP);
19
+        for (j = 0; j <= numt; j++) {
20
+	    for (k = 1; k >= 0; k--) {
21
+		s = (i + k) % numc + 0.5;
22
+		t = j % numt;
23
+
24
+		x = cos(t*twopi/numt) * cos(s*twopi/numc);
25
+		y = sin(t*twopi/numt) * cos(s*twopi/numc);
26
+		z = sin(s*twopi/numc);
27
+		glNormal3f(x, y, z);
28
+
29
+		x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt);
30
+		y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt);
31
+		z = rc * sin(s*twopi/numc);
32
+		glVertex3f(x, y, z);
33
+	    }
34
+        }
35
+	glEnd();
36
+    }
37
+}
38
+
39
+static void normal3f( GLfloat x, GLfloat y, GLfloat z )
40
+{
41
+   GLdouble mag;
42
+
43
+   mag = sqrt( x*x + y*y + z*z );
44
+   if (mag>0.00001F) {
45
+      x /= mag;
46
+      y /= mag;
47
+      z /= mag;
48
+   }
49
+   glNormal3f( x, y, z );
50
+}
51
+
52
+void gluPerspective( GLdouble fovy, GLdouble aspect,
53
+		     GLdouble zNear, GLdouble zFar )
54
+{
55
+   GLdouble xmin, xmax, ymin, ymax;
56
+
57
+   ymax = zNear * tan( fovy * M_PI / 360.0 );
58
+   ymin = -ymax;
59
+
60
+   xmin = ymin * aspect;
61
+   xmax = ymax * aspect;
62
+
63
+   glFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
64
+}
65
+
66
+GLUquadricObj *gluNewQuadric(void)
67
+{
68
+  return NULL;
69
+}
70
+
71
+void gluQuadricDrawStyle(GLUquadricObj *obj, int style)
72
+{
73
+}
74
+
75
+void gluCylinder( GLUquadricObj *qobj,
76
+                  GLdouble baseRadius, GLdouble topRadius, GLdouble height,
77
+                  GLint slices, GLint stacks )
78
+{
79
+   GLdouble da, r, dr, dz;
80
+   GLfloat z, nz, nsign;
81
+   GLint i, j;
82
+   GLfloat du = 1.0 / slices;
83
+   GLfloat dv = 1.0 / stacks;
84
+   GLfloat tcx = 0.0, tcy = 0.0;
85
+   
86
+   nsign = 1.0;
87
+
88
+   da = 2.0*M_PI / slices;
89
+   dr = (topRadius-baseRadius) / stacks;
90
+   dz = height / stacks;
91
+   nz = (baseRadius-topRadius) / height;  /* Z component of normal vectors */
92
+
93
+   for (i=0;i<slices;i++) {
94
+	 GLfloat x1 = -sin(i*da);
95
+	 GLfloat y1 = cos(i*da);
96
+	 GLfloat x2 = -sin((i+1)*da);
97
+	 GLfloat y2 = cos((i+1)*da);
98
+	 z = 0.0;
99
+	 r = baseRadius;
100
+	 tcy = 0.0;
101
+	 glBegin( GL_QUAD_STRIP );
102
+	 for (j=0;j<=stacks;j++) {
103
+	    if (nsign==1.0) {
104
+	       normal3f( x1*nsign, y1*nsign, nz*nsign );
105
+	       glTexCoord2f(tcx, tcy);
106
+	       glVertex3f( x1*r, y1*r, z );
107
+	       normal3f( x2*nsign, y2*nsign, nz*nsign );
108
+	       glTexCoord2f(tcx+du, tcy);
109
+	       glVertex3f( x2*r, y2*r, z );
110
+	    }
111
+	    else {
112
+	       normal3f( x2*nsign, y2*nsign, nz*nsign );
113
+	       glTexCoord2f(tcx, tcy);
114
+	       glVertex3f( x2*r, y2*r, z );
115
+	       normal3f( x1*nsign, y1*nsign, nz*nsign );
116
+	       glTexCoord2f(tcx+du, tcy);
117
+	       glVertex3f( x1*r, y1*r, z );
118
+	    }
119
+	    z += dz;
120
+	    r += dr;
121
+	    tcy += dv;
122
+	 }
123
+	 glEnd();
124
+	 tcx += du;
125
+      }
126
+}
127
+
128
+/* Disk (adapted from Mesa) */
129
+
130
+void gluDisk( GLUquadricObj *qobj,
131
+              GLdouble innerRadius, GLdouble outerRadius,
132
+              GLint slices, GLint loops )
133
+{
134
+   GLdouble a, da;
135
+   GLfloat dr;
136
+   GLfloat r1, r2, dtc;
137
+   GLint s, l;
138
+   GLfloat sa,ca;
139
+
140
+   /* Normal vectors */
141
+	 glNormal3f( 0.0, 0.0, +1.0 );
142
+
143
+   da = 2.0*M_PI / slices;
144
+   dr = (outerRadius-innerRadius) / (GLfloat) loops;
145
+
146
+   /* texture of a gluDisk is a cut out of the texture unit square */
147
+   /* x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] (linear mapping) */
148
+   dtc = 2.0f * outerRadius;
149
+
150
+   r1 = innerRadius;
151
+   for (l=0;l<loops;l++) {
152
+	    r2 = r1 + dr;
153
+	       glBegin( GL_QUAD_STRIP );
154
+	       for (s=0;s<=slices;s++) {
155
+		  if (s==slices) a = 0.0;
156
+		  else  a = s * da;
157
+		  sa = sin(a); ca = cos(a);
158
+                  glTexCoord2f(0.5+sa*r2/dtc,0.5+ca*r2/dtc);
159
+                  glVertex2f( r2*sa, r2*ca );
160
+                  glTexCoord2f(0.5+sa*r1/dtc,0.5+ca*r1/dtc);
161
+                  glVertex2f( r1*sa, r1*ca );
162
+	       }
163
+	       glEnd();
164
+	    r1 = r2;
165
+	 }
166
+
167
+}
168
+
169
+/*
170
+ * Sphère (adapted from Mesa)
171
+ */
172
+
173
+void gluSphere(GLUquadricObj *qobj,
174
+               float radius,int slices,int stacks)
175
+{
176
+   float rho, drho, theta, dtheta;
177
+   float x, y, z;
178
+   float s, t, ds, dt;
179
+   int i, j, imin, imax;
180
+   int normals;
181
+   float nsign;
182
+  
183
+   normals=1;
184
+   nsign=1;
185
+
186
+   drho = M_PI / (float) stacks;
187
+   dtheta = 2.0 * M_PI / (float) slices;
188
+
189
+  /* draw +Z end as a triangle fan */
190
+  glBegin( GL_TRIANGLE_FAN );
191
+  glNormal3f( 0.0, 0.0, 1.0 );
192
+  glTexCoord2f(0.5,0.0);
193
+  glVertex3f( 0.0, 0.0, nsign * radius );
194
+  for (j=0;j<=slices;j++) {
195
+	 theta = (j==slices) ? 0.0 : j * dtheta;
196
+	 x = -sin(theta) * sin(drho);
197
+	 y = cos(theta) * sin(drho);
198
+	 z = nsign * cos(drho);
199
+	 if (normals)  glNormal3f( x*nsign, y*nsign, z*nsign );
200
+	 glVertex3f( x*radius, y*radius, z*radius );
201
+      }
202
+   glEnd();
203
+
204
+
205
+      ds = 1.0 / slices;
206
+      dt = 1.0 / stacks;
207
+      t = 1.0;  /* because loop now runs from 0 */
208
+      if (1) {
209
+        imin = 0;
210
+        imax = stacks;
211
+      }
212
+      else {
213
+        imin = 1;
214
+        imax = stacks-1;
215
+      }
216
+
217
+      /* draw intermediate stacks as quad strips */
218
+      for (i=imin;i<imax;i++) {
219
+	 rho = i * drho;
220
+	 glBegin( GL_QUAD_STRIP );
221
+         s = 0.0;
222
+	 for (j=0;j<=slices;j++) {
223
+	    theta = (j==slices) ? 0.0 : j * dtheta;
224
+	    x = -sin(theta) * sin(rho);
225
+	    y = cos(theta) * sin(rho);
226
+	    z = nsign * cos(rho);
227
+	    if (normals)  glNormal3f( x*nsign, y*nsign, z*nsign );
228
+	    glTexCoord2f(s,1-t);
229
+	    glVertex3f( x*radius, y*radius, z*radius );
230
+	    x = -sin(theta) * sin(rho+drho);
231
+	    y = cos(theta) * sin(rho+drho);
232
+	    z = nsign * cos(rho+drho);
233
+	    if (normals)  glNormal3f( x*nsign, y*nsign, z*nsign );
234
+	    glTexCoord2f(s,1-(t-dt));
235
+            s += ds;
236
+	    glVertex3f( x*radius, y*radius, z*radius );
237
+	 }
238
+	 glEnd();
239
+	 t -= dt;
240
+      }
241
+
242
+/* draw -Z end as a triangle fan */
243
+    glBegin( GL_TRIANGLE_FAN );
244
+    glNormal3f( 0.0, 0.0, -1.0 );
245
+      glTexCoord2f(0.5,1.0);
246
+      glVertex3f( 0.0, 0.0, -radius*nsign );
247
+      rho = M_PI - drho;
248
+      s = 1.0;
249
+      t = dt;
250
+      for (j=slices;j>=0;j--) {
251
+	 theta = (j==slices) ? 0.0 : j * dtheta;
252
+	 x = -sin(theta) * sin(rho);
253
+	 y = cos(theta) * sin(rho);
254
+	 z = nsign * cos(rho);
255
+	 if (normals)  glNormal3f( x*nsign, y*nsign, z*nsign );
256
+	 glTexCoord2f(s,1-t);
257
+         s -= ds;
258
+	 glVertex3f( x*radius, y*radius, z*radius );
259
+      }
260
+      glEnd();
261
+}

+ 23 - 0
3rdparty/tinygl-0.4-ugfx/examples/glu.h

@@ -0,0 +1,23 @@
1
+
2
+void gluPerspective( GLdouble fovy, GLdouble aspect,
3
+		     GLdouble zNear, GLdouble zFar );
4
+
5
+typedef struct {
6
+  int draw_style;
7
+} GLUquadricObj;
8
+
9
+#define GLU_LINE 0
10
+
11
+GLUquadricObj *gluNewQuadric(void);
12
+void gluQuadricDrawStyle(GLUquadricObj *obj, int style);
13
+
14
+void gluSphere(GLUquadricObj *qobj,
15
+               float radius,int slices,int stacks);
16
+void gluCylinder( GLUquadricObj *qobj,
17
+                  GLdouble baseRadius, GLdouble topRadius, GLdouble height,
18
+                  GLint slices, GLint stacks );
19
+void gluDisk( GLUquadricObj *qobj,
20
+              GLdouble innerRadius, GLdouble outerRadius,
21
+              GLint slices, GLint loops );
22
+
23
+void drawTorus(float rc, int numc, float rt, int numt);

File diff suppressed because it is too large
+ 1753 - 0
3rdparty/tinygl-0.4-ugfx/examples/mech.c


+ 113 - 0
3rdparty/tinygl-0.4-ugfx/examples/nanox.c

@@ -0,0 +1,113 @@
1
+/*
2
+ * Demonstration program for Nano-X graphics.
3
+ */
4
+#include <stdio.h>
5
+#include <stdlib.h>
6
+#include <string.h>
7
+#define MWINCLUDECOLORS
8
+#include <microwin/nano-X.h>
9
+#include <GL/gl.h> 
10
+#include <GL/nglx.h> 
11
+#include "ui.h"
12
+
13
+static	GR_WINDOW_ID	w1;		/* id for large window */
14
+static	GR_GC_ID	gc1;		/* graphics context for text */
15
+
16
+void errorcatcher();			/* routine to handle errors */
17
+
18
+void tkSwapBuffers(void)
19
+{
20
+    nglXSwapBuffers(w1);
21
+}
22
+
23
+int
24
+ui_loop(int argc,char **argv, const char *name)
25
+{
26
+	GR_EVENT	event;		/* current event */
27
+	GR_IMAGE_ID	id = 0;
28
+        NGLXContext cx;
29
+        int width, height, k;
30
+
31
+	if (GrOpen() < 0) {
32
+		fprintf(stderr, "cannot open graphics\n");
33
+		exit(1);
34
+	}
35
+	
36
+        width = 400;
37
+        height = 300;
38
+
39
+	GrSetErrorHandler(errorcatcher);
40
+
41
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 10, 10, width, height, 4, BLACK, WHITE);
42
+
43
+	GrSelectEvents(w1, GR_EVENT_MASK_CLOSE_REQ|GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN);
44
+
45
+	GrMapWindow(w1);
46
+
47
+	gc1 = GrNewGC();
48
+
49
+	GrSetGCForeground(gc1, WHITE);
50
+
51
+        cx = nglXCreateContext(NULL, 0);
52
+        nglXMakeCurrent(w1, cx);
53
+        
54
+        init();
55
+        reshape(width, height);
56
+
57
+	while (1) {
58
+            GrCheckNextEvent(&event);
59
+            switch(event.type) {
60
+            case GR_EVENT_TYPE_CLOSE_REQ:
61
+                GrFreeImage(id);
62
+                GrClose();
63
+                exit(0);
64
+            case GR_EVENT_TYPE_EXPOSURE:
65
+                break;
66
+            case GR_EVENT_TYPE_KEY_DOWN:
67
+                {
68
+                    GR_EVENT_KEYSTROKE *kp = &event.keystroke;
69
+                    /* XXX: nanoX special keys are totally bugged ! */
70
+                    switch(kp->ch) {
71
+                    case 81:
72
+                        k = KEY_LEFT;
73
+                        break;
74
+                    case 83:
75
+                        k = KEY_RIGHT;
76
+                        break;
77
+                    case 82:
78
+                        k = KEY_UP;
79
+                        break;
80
+                    case 84:
81
+                        k = KEY_DOWN;
82
+                        break;
83
+                    default:
84
+                        k = kp->ch;
85
+                        break;
86
+                    }
87
+                    key(k, 0);
88
+                }
89
+                break;
90
+            default:
91
+                idle();
92
+                break;
93
+            }
94
+        }
95
+
96
+	return 0;
97
+}
98
+
99
+
100
+/*
101
+ * Here on an unrecoverable error.
102
+ */
103
+void
104
+errorcatcher(code, name, id)
105
+	GR_ERROR	code;		/* error code */
106
+	GR_FUNC_NAME	name;		/* function name which failed */
107
+	GR_ID		id;		/* resource id */
108
+{
109
+	GrClose();
110
+	fprintf(stderr, "DEMO ERROR: code %d, function %s, resource id %d\n",
111
+		code, name, id);
112
+	exit(1);
113
+}

+ 160 - 0
3rdparty/tinygl-0.4-ugfx/examples/spin.c

@@ -0,0 +1,160 @@
1
+/* spin.c */
2
+
3
+
4
+/*
5
+ * Spinning box.  This program is in the public domain.
6
+ *
7
+ * Brian Paul
8
+ */
9
+
10
+
11
+#include <math.h>
12
+#include <stdio.h>
13
+
14
+#include <GL/glx.h> 
15
+#include <GL/gl.h> 
16
+#include "ui.h"
17
+
18
+
19
+
20
+
21
+static GLfloat Xrot, Xstep;
22
+static GLfloat Yrot, Ystep;
23
+static GLfloat Zrot, Zstep;
24
+static GLfloat Step = 5.0;
25
+static GLfloat Scale = 1.0;
26
+static GLuint Object;
27
+
28
+
29
+
30
+
31
+static GLuint make_object( void )
32
+{
33
+   GLuint list;
34
+
35
+   list = glGenLists( 1 );
36
+
37
+   glNewList( list, GL_COMPILE );
38
+
39
+   glBegin( GL_LINE_LOOP );
40
+   glColor3f( 1.0, 1.0, 1.0 );
41
+   glVertex3f(  1.0,  0.5, -0.4 );
42
+   glColor3f( 1.0, 0.0, 0.0 );
43
+   glVertex3f(  1.0, -0.5, -0.4 );
44
+   glColor3f( 0.0, 1.0, 0.0 );
45
+   glVertex3f( -1.0, -0.5, -0.4 );
46
+   glColor3f( 0.0, 0.0, 1.0 );
47
+   glVertex3f( -1.0,  0.5, -0.4 );
48
+   glEnd();
49
+
50
+   glColor3f( 1.0, 1.0, 1.0 );
51
+
52
+   glBegin( GL_LINE_LOOP );
53
+   glVertex3f(  1.0,  0.5, 0.4 );
54
+   glVertex3f(  1.0, -0.5, 0.4 );
55
+   glVertex3f( -1.0, -0.5, 0.4 );
56
+   glVertex3f( -1.0,  0.5, 0.4 );
57
+   glEnd();
58
+
59
+   glBegin( GL_LINES );
60
+   glVertex3f(  1.0,  0.5, -0.4 );   glVertex3f(  1.0,  0.5, 0.4 );
61
+   glVertex3f(  1.0, -0.5, -0.4 );   glVertex3f(  1.0, -0.5, 0.4 );
62
+   glVertex3f( -1.0, -0.5, -0.4 );   glVertex3f( -1.0, -0.5, 0.4 );
63
+   glVertex3f( -1.0,  0.5, -0.4 );   glVertex3f( -1.0,  0.5, 0.4 );
64
+   glEnd();
65
+
66
+
67
+   glEndList();
68
+
69
+   return list;
70
+}
71
+
72
+
73
+
74
+void reshape( int width, int height )
75
+{
76
+   glViewport(0, 0, (GLint)width, (GLint)height);
77
+   glMatrixMode(GL_PROJECTION);
78
+   glLoadIdentity();
79
+   glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
80
+   glMatrixMode(GL_MODELVIEW);
81
+}
82
+
83
+
84
+GLenum key(int k, GLenum mask)
85
+{
86
+   switch (k) {
87
+   case KEY_ESCAPE:
88
+       exit(0);
89
+   }
90
+   return GL_FALSE;
91
+}
92
+
93
+
94
+void draw( void )
95
+{
96
+   glClear( GL_COLOR_BUFFER_BIT );
97
+
98
+   glPushMatrix();
99
+
100
+   glTranslatef( 0.0, 0.0, -10.0 );
101
+   glScalef( Scale, Scale, Scale );
102
+   if (Xstep) {
103
+      glRotatef( Xrot, 1.0, 0.0, 0.0 );
104
+   }
105
+   else if (Ystep) {
106
+      glRotatef( Yrot, 0.0, 1.0, 0.0 );
107
+   }
108
+   else {
109
+      glRotatef( Zrot, 0.0, 0.0, 1.0 );
110
+   }
111
+
112
+   glCallList( Object );
113
+
114
+   glPopMatrix();
115
+
116
+   glFlush();
117
+   tkSwapBuffers();
118
+}
119
+
120
+
121
+void idle( void )
122
+{
123
+   Xrot += Xstep;
124
+   Yrot += Ystep;
125
+   Zrot += Zstep;
126
+
127
+   if (Xrot>=360.0) {
128
+      Xrot = Xstep = 0.0;
129
+      Ystep = Step;
130
+   }
131
+   else if (Yrot>=360.0) {
132
+      Yrot = Ystep = 0.0;
133
+      Zstep = Step;
134
+   }
135
+   else if (Zrot>=360.0) {
136
+      Zrot = Zstep = 0.0;
137
+      Xstep = Step;
138
+   }
139
+   draw();
140
+}
141
+
142
+void init(void)
143
+{
144
+   Object = make_object();
145
+   glCullFace( GL_BACK );
146
+/*   glEnable( GL_CULL_FACE );*/
147
+   glDisable( GL_DITHER );
148
+   glShadeModel( GL_FLAT );
149
+/*   glEnable( GL_DEPTH_TEST ); */
150
+
151
+   Xrot = Yrot = Zrot = 0.0;
152
+   Xstep = Step;
153
+   Ystep = Zstep = 0.0;
154
+}
155
+
156
+
157
+int main( int argc, char *argv[] )
158
+{
159
+    return ui_loop(argc, argv, "spin");
160
+}

+ 193 - 0
3rdparty/tinygl-0.4-ugfx/examples/texobj.c

@@ -0,0 +1,193 @@
1
+/*
2
+ * Example of using the 1.1 texture object functions.
3
+ * Also, this demo utilizes Mesa's fast texture map path.
4
+ *
5
+ * Brian Paul   June 1996
6
+ */
7
+
8
+#include <math.h>
9
+#include <stdlib.h>
10
+#include <stdio.h>
11
+#include <string.h>
12
+
13
+#include <GL/glx.h> 
14
+#include <GL/gl.h> 
15
+#include "ui.h"
16
+
17
+static GLuint TexObj[2];
18
+static GLfloat Angle = 0.0f;
19
+
20
+static int cnt=0,v=0;
21
+
22
+void 
23
+draw(void)
24
+{
25
+  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
26
+
27
+  glColor3f(1.0, 1.0, 1.0);
28
+
29
+  /* draw first polygon */
30
+  glPushMatrix();
31
+  glTranslatef(-1.0, 0.0, 0.0);
32
+  glRotatef(Angle, 0.0, 0.0, 1.0);
33
+  glBindTexture(GL_TEXTURE_2D, TexObj[v]);
34
+
35
+  glEnable(GL_TEXTURE_2D);
36
+  glBegin(GL_QUADS);
37
+  glTexCoord2f(0.0, 0.0);
38
+  glVertex2f(-1.0, -1.0);
39
+  glTexCoord2f(1.0, 0.0);
40
+  glVertex2f(1.0, -1.0);
41
+  glTexCoord2f(1.0, 1.0);
42
+  glVertex2f(1.0, 1.0);
43
+  glTexCoord2f(0.0, 1.0);
44
+  glVertex2f(-1.0, 1.0);
45
+  glEnd();
46
+  glDisable(GL_TEXTURE_2D);
47
+  glPopMatrix();
48
+
49
+  /* draw second polygon */
50
+  glPushMatrix();
51
+  glTranslatef(1.0, 0.0, 0.0);
52
+  glRotatef(Angle - 90.0, 0.0, 1.0, 0.0);
53
+
54
+  glBindTexture(GL_TEXTURE_2D, TexObj[1-v]);
55
+
56
+  glEnable(GL_TEXTURE_2D);
57
+  glBegin(GL_QUADS);
58
+  glTexCoord2f(0.0, 0.0);
59
+  glVertex2f(-1.0, -1.0);
60
+  glTexCoord2f(1.0, 0.0);
61
+  glVertex2f(1.0, -1.0);
62
+  glTexCoord2f(1.0, 1.0);
63
+  glVertex2f(1.0, 1.0);
64
+  glTexCoord2f(0.0, 1.0);
65
+  glVertex2f(-1.0, 1.0);
66
+  glEnd();
67
+  glDisable(GL_TEXTURE_2D);
68
+
69
+  glPopMatrix();
70
+
71
+  tkSwapBuffers();
72
+}
73
+
74
+
75
+/* new window size or exposure */
76
+void 
77
+reshape(int width, int height)
78
+{
79
+  glViewport(0, 0, (GLint) width, (GLint) height);
80
+  glMatrixMode(GL_PROJECTION);
81
+  glLoadIdentity();
82
+  /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 ); */
83
+  glFrustum(-2.0, 2.0, -2.0, 2.0, 6.0, 20.0);
84
+  glMatrixMode(GL_MODELVIEW);
85
+  glLoadIdentity();
86
+  glTranslatef(0.0, 0.0, -8.0);
87
+}
88
+
89
+
90
+void bind_texture(int texobj,int image)
91
+{
92
+  static int width = 8, height = 8;
93
+  static int color[2][3]={
94
+    {255,0,0},
95
+    {0,255,0},
96
+  };
97
+  GLubyte tex[64][3];
98
+  static GLubyte texchar[2][8*8] = {
99
+  {
100
+    0, 0, 0, 0, 0, 0, 0, 0,
101
+    0, 0, 0, 0, 1, 0, 0, 0,
102
+    0, 0, 0, 1, 1, 0, 0, 0,
103
+    0, 0, 0, 0, 1, 0, 0, 0,
104
+    0, 0, 0, 0, 1, 0, 0, 0,
105
+    0, 0, 0, 0, 1, 0, 0, 0,
106
+    0, 0, 0, 1, 1, 1, 0, 0,
107
+    0, 0, 0, 0, 0, 0, 0, 0},
108
+  {
109
+    0, 0, 0, 0, 0, 0, 0, 0,
110
+    0, 0, 0, 2, 2, 0, 0, 0,
111
+    0, 0, 2, 0, 0, 2, 0, 0,
112
+    0, 0, 0, 0, 0, 2, 0, 0,
113
+    0, 0, 0, 0, 2, 0, 0, 0,
114
+    0, 0, 0, 2, 0, 0, 0, 0,
115
+    0, 0, 2, 2, 2, 2, 0, 0,
116
+    0, 0, 0, 0, 0, 0, 0, 0}};
117
+
118
+  int i,j;
119
+  
120
+  glBindTexture(GL_TEXTURE_2D, texobj);
121
+
122
+  /* red on white */
123
+  for (i = 0; i < height; i++) {
124
+    for (j = 0; j < width; j++) {
125
+      int p = i * width + j;
126
+      if (texchar[image][(height - i - 1) * width + j]) {
127
+        tex[p][0] = color[image][0];
128
+        tex[p][1] = color[image][1];
129
+        tex[p][2] = color[image][2];
130
+      } else {
131
+        tex[p][0] = 255;
132
+        tex[p][1] = 255;
133
+        tex[p][2] = 255;
134
+      }
135
+    }
136
+  }
137
+  glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0,
138
+    GL_RGB, GL_UNSIGNED_BYTE, tex);
139
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
140
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
141
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
142
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
143
+  /* end of texture object */
144
+}
145
+
146
+
147
+
148
+void 
149
+init(void)
150
+{
151
+  glEnable(GL_DEPTH_TEST);
152
+
153
+  /* Setup texturing */
154
+  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
155
+  glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
156
+
157
+  /* generate texture object IDs */
158
+  glGenTextures(2, TexObj);
159
+  bind_texture(TexObj[0],0);
160
+  bind_texture(TexObj[1],1);
161
+  
162
+}
163
+
164
+void 
165
+idle(void)
166
+{
167
+  
168
+  Angle += 2.0;
169
+
170
+  if (++cnt==5) {
171
+    cnt=0;
172
+    v=!v;
173
+  }
174
+  draw();
175
+}
176
+
177
+/* change view angle, exit upon ESC */
178
+GLenum key(int k, GLenum mask)
179
+{
180
+   switch (k) {
181
+      case 'q':
182
+      case KEY_ESCAPE:
183
+          exit(0);
184
+   }
185
+   return GL_FALSE;
186
+}
187
+
188
+int main(int argc, char **argv) 
189
+{
190
+    return ui_loop(argc, argv, "texobj");
191
+}
192
+
193
+

+ 17 - 0
3rdparty/tinygl-0.4-ugfx/examples/ui.h

@@ -0,0 +1,17 @@
1
+/*
2
+ * tk like ui
3
+ */
4
+void draw( void );
5
+void idle( void );
6
+GLenum key(int k, GLenum mask);
7
+void reshape( int width, int height );
8
+void init( void );
9
+int ui_loop(int argc, char **argv, const char *name);
10
+void tkSwapBuffers(void);
11
+
12
+#define KEY_UP     0xe000
13
+#define KEY_DOWN   0xe001
14
+#define KEY_LEFT   0xe002
15
+#define KEY_RIGHT  0xe003
16
+#define KEY_ESCAPE 0xe004
17
+

+ 139 - 0
3rdparty/tinygl-0.4-ugfx/examples/x11.c

@@ -0,0 +1,139 @@
1
+#include <math.h>
2
+#include <stdlib.h>
3
+#include <stdio.h>
4
+#include <string.h>
5
+
6
+#include <X11/Xlib.h>
7
+#include <X11/Xutil.h>
8
+#include <X11/keysym.h>
9
+
10
+#include <GL/glx.h> 
11
+#include <GL/gl.h> 
12
+#include "ui.h"
13
+
14
+
15
+#ifndef M_PI
16
+#  define M_PI 3.14159265
17
+#endif
18
+
19
+static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
20
+
21
+static Bool WaitForNotify(Display *d, XEvent *e, char *arg) 
22
+{
23
+  return (e->type == MapNotify) && (e->xmap.window == (Window)arg); 
24
+}
25
+
26
+Display *dpy;
27
+Window win;
28
+
29
+void tkSwapBuffers(void)
30
+{
31
+    glXSwapBuffers(dpy,win);
32
+}
33
+
34
+int ui_loop(int argc, char **argv, const char *name)
35
+{
36
+  XVisualInfo *vi;
37
+  Colormap cmap;
38
+  XSetWindowAttributes swa;
39
+  XSizeHints hint;
40
+  GLXContext cx;
41
+  XEvent event;
42
+  int k, width, height;
43
+  char buf[80];
44
+  XEvent xev;
45
+  KeySym keysym;
46
+  XComposeStatus status;
47
+  
48
+  /* get a connection */
49
+  dpy = XOpenDisplay(NULL);
50
+  if (dpy == NULL) {
51
+      fprintf(stderr,"Could not open X display\n");
52
+      exit(1);
53
+  }
54
+  
55
+  /* get an appropriate visual */
56
+  vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList);
57
+  if (vi == NULL) {
58
+      fprintf(stderr, "No suitable visual for glx\n");
59
+      exit(1);
60
+  }
61
+      
62
+  /* create a GLX context */
63
+  cx = glXCreateContext(dpy, vi, 0, GL_TRUE);
64
+
65
+  /* create a color map */
66
+  cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
67
+			 vi->visual, AllocNone);
68
+
69
+  /* create a window */
70
+  width = 400;
71
+  height = 300;
72
+  hint.x = 0;
73
+  hint.y = 0;
74
+  hint.width = width;
75
+  hint.height = height;
76
+  hint.flags = PPosition | PSize;
77
+  swa.colormap = cmap;
78
+  swa.border_pixel = 0;
79
+  swa.event_mask = StructureNotifyMask;
80
+  win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height,
81
+		      0, vi->depth, InputOutput, vi->visual,
82
+		      CWBorderPixel|CWColormap|CWEventMask, &swa);
83
+  XSetStandardProperties (dpy, win, name, name, None, NULL, 0, &hint);
84
+
85
+  XMapWindow(dpy, win);
86
+  XIfEvent(dpy, &event, WaitForNotify, (char*)win);
87
+  XSelectInput(dpy, win, KeyPressMask | StructureNotifyMask | ExposureMask);
88
+
89
+  /* connect the context to the window */
90
+  glXMakeCurrent(dpy, win, cx);
91
+
92
+  init();
93
+  reshape(width, height);
94
+
95
+  while (1) {
96
+    if (XPending(dpy) > 0) {
97
+      XNextEvent(dpy,&xev);
98
+      switch(xev.type) {
99
+      case KeyPress:
100
+	XLookupString((XKeyEvent *)&xev,buf,80,&keysym,&status);
101
+        switch(keysym) {
102
+        case XK_Up:
103
+            k = KEY_UP;
104
+            break;
105
+        case XK_Down:
106
+            k = KEY_DOWN;
107
+            break;
108
+        case XK_Left:
109
+            k = KEY_LEFT;
110
+            break;
111
+        case XK_Right:
112
+            k = KEY_RIGHT;
113
+            break;
114
+        case XK_Escape:
115
+            k = KEY_ESCAPE;
116
+            break;
117
+        default:
118
+            k = keysym;
119
+        }
120
+        key(k, 0);
121
+	break;
122
+      case ConfigureNotify:
123
+	{
124
+	  int width,height;
125
+	  width = xev.xconfigure.width;
126
+	  height = xev.xconfigure.height;
127
+	  glXWaitX();
128
+          reshape(width, height);
129
+	}
130
+	break;
131
+      }
132
+    } else {
133
+      idle();
134
+    }
135
+  }
136
+  return 0;
137
+}
138
+
139
+

+ 838 - 0
3rdparty/tinygl-0.4-ugfx/include/GL/gl.h

@@ -0,0 +1,838 @@
1
+/*
2
+ * The following constants come from Mesa
3
+ */
4
+#ifndef GL_H
5
+#define GL_H
6
+
7
+#define GL_VERSION_1_1 1
8
+
9
+#ifdef __cplusplus
10
+extern "C" {
11
+#endif
12
+
13
+enum {
14
+	/* Boolean values */
15
+	GL_FALSE			= 0,
16
+	GL_TRUE				= 1,
17
+
18
+	/* Data types */
19
+	GL_BYTE				= 0x1400,
20
+	GL_UNSIGNED_BYTE		= 0x1401,
21
+	GL_SHORT			= 0x1402,
22
+	GL_UNSIGNED_SHORT		= 0x1403,
23
+	GL_INT				= 0x1404,
24
+	GL_UNSIGNED_INT			= 0x1405,
25
+	GL_FLOAT			= 0x1406,
26
+	GL_DOUBLE			= 0x140A,
27
+	GL_2_BYTES			= 0x1407,
28
+	GL_3_BYTES			= 0x1408,
29
+	GL_4_BYTES			= 0x1409,
30
+
31
+	/* Primitives */
32
+	GL_LINES			= 0x0001,
33
+	GL_POINTS			= 0x0000,
34
+	GL_LINE_STRIP			= 0x0003,
35
+	GL_LINE_LOOP			= 0x0002,
36
+	GL_TRIANGLES			= 0x0004,
37
+	GL_TRIANGLE_STRIP		= 0x0005,
38
+	GL_TRIANGLE_FAN			= 0x0006,
39
+	GL_QUADS			= 0x0007,
40
+	GL_QUAD_STRIP			= 0x0008,
41
+	GL_POLYGON			= 0x0009,
42
+	GL_EDGE_FLAG			= 0x0B43,
43
+
44
+	/* Vertex Arrays */
45
+	GL_VERTEX_ARRAY			= 0x8074,
46
+	GL_NORMAL_ARRAY			= 0x8075,
47
+	GL_COLOR_ARRAY			= 0x8076,
48
+	GL_INDEX_ARRAY			= 0x8077,
49
+	GL_TEXTURE_COORD_ARRAY		= 0x8078,
50
+	GL_EDGE_FLAG_ARRAY		= 0x8079,
51
+	GL_VERTEX_ARRAY_SIZE		= 0x807A,
52
+	GL_VERTEX_ARRAY_TYPE		= 0x807B,
53
+	GL_VERTEX_ARRAY_STRIDE		= 0x807C,
54
+	GL_VERTEX_ARRAY_COUNT		= 0x807D,
55
+	GL_NORMAL_ARRAY_TYPE		= 0x807E,
56
+	GL_NORMAL_ARRAY_STRIDE		= 0x807F,
57
+	GL_NORMAL_ARRAY_COUNT		= 0x8080,
58
+	GL_COLOR_ARRAY_SIZE		= 0x8081,
59
+	GL_COLOR_ARRAY_TYPE		= 0x8082,
60
+	GL_COLOR_ARRAY_STRIDE		= 0x8083,
61
+	GL_COLOR_ARRAY_COUNT		= 0x8084,
62
+	GL_INDEX_ARRAY_TYPE		= 0x8085,
63
+	GL_INDEX_ARRAY_STRIDE		= 0x8086,
64
+	GL_INDEX_ARRAY_COUNT		= 0x8087,
65
+	GL_TEXTURE_COORD_ARRAY_SIZE	= 0x8088,
66
+	GL_TEXTURE_COORD_ARRAY_TYPE	= 0x8089,
67
+	GL_TEXTURE_COORD_ARRAY_STRIDE	= 0x808A,
68
+	GL_TEXTURE_COORD_ARRAY_COUNT	= 0x808B,
69
+	GL_EDGE_FLAG_ARRAY_STRIDE	= 0x808C,
70
+	GL_EDGE_FLAG_ARRAY_COUNT	= 0x808D,
71
+	GL_VERTEX_ARRAY_POINTER		= 0x808E,
72
+	GL_NORMAL_ARRAY_POINTER		= 0x808F,
73
+	GL_COLOR_ARRAY_POINTER		= 0x8090,
74
+	GL_INDEX_ARRAY_POINTER		= 0x8091,
75
+	GL_TEXTURE_COORD_ARRAY_POINTER	= 0x8092,
76
+	GL_EDGE_FLAG_ARRAY_POINTER	= 0x8093,
77
+        GL_V2F				= 0x2A20,
78
+	GL_V3F				= 0x2A21,
79
+	GL_C4UB_V2F			= 0x2A22,
80
+	GL_C4UB_V3F			= 0x2A23,
81
+	GL_C3F_V3F			= 0x2A24,
82
+	GL_N3F_V3F			= 0x2A25,
83
+	GL_C4F_N3F_V3F			= 0x2A26,
84
+	GL_T2F_V3F			= 0x2A27,
85
+	GL_T4F_V4F			= 0x2A28,
86
+	GL_T2F_C4UB_V3F			= 0x2A29,
87
+	GL_T2F_C3F_V3F			= 0x2A2A,
88
+	GL_T2F_N3F_V3F			= 0x2A2B,
89
+	GL_T2F_C4F_N3F_V3F		= 0x2A2C,
90
+	GL_T4F_C4F_N3F_V4F		= 0x2A2D,
91
+
92
+	/* Matrix Mode */
93
+	GL_MATRIX_MODE			= 0x0BA0,
94
+	GL_MODELVIEW			= 0x1700,
95
+	GL_PROJECTION			= 0x1701,
96
+	GL_TEXTURE			= 0x1702,
97
+
98
+	/* Points */
99
+	GL_POINT_SMOOTH			= 0x0B10,
100
+	GL_POINT_SIZE			= 0x0B11,
101
+	GL_POINT_SIZE_GRANULARITY 	= 0x0B13,
102
+	GL_POINT_SIZE_RANGE		= 0x0B12,
103
+
104
+	/* Lines */
105
+	GL_LINE_SMOOTH			= 0x0B20,
106
+	GL_LINE_STIPPLE			= 0x0B24,
107
+	GL_LINE_STIPPLE_PATTERN		= 0x0B25,
108
+	GL_LINE_STIPPLE_REPEAT		= 0x0B26,
109
+	GL_LINE_WIDTH			= 0x0B21,
110
+	GL_LINE_WIDTH_GRANULARITY	= 0x0B23,
111
+	GL_LINE_WIDTH_RANGE		= 0x0B22,
112
+
113
+	/* Polygons */
114
+	GL_POINT			= 0x1B00,
115
+	GL_LINE				= 0x1B01,
116
+	GL_FILL				= 0x1B02,
117
+	GL_CCW				= 0x0901,
118
+	GL_CW				= 0x0900,
119
+	GL_FRONT			= 0x0404,
120
+	GL_BACK				= 0x0405,
121
+	GL_CULL_FACE			= 0x0B44,
122
+	GL_CULL_FACE_MODE		= 0x0B45,
123
+	GL_POLYGON_SMOOTH		= 0x0B41,
124
+	GL_POLYGON_STIPPLE		= 0x0B42,
125
+	GL_FRONT_FACE			= 0x0B46,
126
+	GL_POLYGON_MODE			= 0x0B40,
127
+	GL_POLYGON_OFFSET_FACTOR	= 0x3038,
128
+	GL_POLYGON_OFFSET_UNITS		= 0x2A00,
129
+	GL_POLYGON_OFFSET_POINT		= 0x2A01,
130
+	GL_POLYGON_OFFSET_LINE		= 0x2A02,
131
+	GL_POLYGON_OFFSET_FILL		= 0x8037,
132
+
133
+	/* Display Lists */
134
+	GL_COMPILE			= 0x1300,
135
+	GL_COMPILE_AND_EXECUTE		= 0x1301,
136
+	GL_LIST_BASE			= 0x0B32,
137
+	GL_LIST_INDEX			= 0x0B33,
138
+	GL_LIST_MODE			= 0x0B30,
139
+
140
+	/* Depth buffer */
141
+	GL_NEVER			= 0x0200,
142
+	GL_LESS				= 0x0201,
143
+	GL_GEQUAL			= 0x0206,
144
+	GL_LEQUAL			= 0x0203,
145
+	GL_GREATER			= 0x0204,
146
+	GL_NOTEQUAL			= 0x0205,
147
+	GL_EQUAL			= 0x0202,
148
+	GL_ALWAYS			= 0x0207,
149
+	GL_DEPTH_TEST			= 0x0B71,
150
+	GL_DEPTH_BITS			= 0x0D56,
151
+	GL_DEPTH_CLEAR_VALUE		= 0x0B73,
152
+	GL_DEPTH_FUNC			= 0x0B74,
153
+	GL_DEPTH_RANGE			= 0x0B70,
154
+	GL_DEPTH_WRITEMASK		= 0x0B72,
155
+	GL_DEPTH_COMPONENT		= 0x1902,
156
+
157
+	/* Lighting */
158
+	GL_LIGHTING			= 0x0B50,
159
+	GL_LIGHT0			= 0x4000,
160
+	GL_LIGHT1			= 0x4001,
161
+	GL_LIGHT2			= 0x4002,
162
+	GL_LIGHT3			= 0x4003,
163
+	GL_LIGHT4			= 0x4004,
164
+	GL_LIGHT5			= 0x4005,
165
+	GL_LIGHT6			= 0x4006,
166
+	GL_LIGHT7			= 0x4007,
167
+	GL_SPOT_EXPONENT		= 0x1205,
168
+	GL_SPOT_CUTOFF			= 0x1206,
169
+	GL_CONSTANT_ATTENUATION		= 0x1207,
170
+	GL_LINEAR_ATTENUATION		= 0x1208,
171
+	GL_QUADRATIC_ATTENUATION	= 0x1209,
172
+	GL_AMBIENT			= 0x1200,
173
+	GL_DIFFUSE			= 0x1201,
174
+	GL_SPECULAR			= 0x1202,
175
+	GL_SHININESS			= 0x1601,
176
+	GL_EMISSION			= 0x1600,
177
+	GL_POSITION			= 0x1203,
178
+	GL_SPOT_DIRECTION		= 0x1204,
179
+	GL_AMBIENT_AND_DIFFUSE		= 0x1602,
180
+	GL_COLOR_INDEXES		= 0x1603,
181
+	GL_LIGHT_MODEL_TWO_SIDE		= 0x0B52,
182
+	GL_LIGHT_MODEL_LOCAL_VIEWER	= 0x0B51,
183
+	GL_LIGHT_MODEL_AMBIENT		= 0x0B53,
184
+	GL_FRONT_AND_BACK		= 0x0408,
185
+	GL_SHADE_MODEL			= 0x0B54,
186
+	GL_FLAT				= 0x1D00,
187
+	GL_SMOOTH			= 0x1D01,
188
+	GL_COLOR_MATERIAL		= 0x0B57,
189
+	GL_COLOR_MATERIAL_FACE		= 0x0B55,
190
+	GL_COLOR_MATERIAL_PARAMETER	= 0x0B56,
191
+	GL_NORMALIZE			= 0x0BA1,
192
+
193
+	/* User clipping planes */
194
+	GL_CLIP_PLANE0			= 0x3000,
195
+	GL_CLIP_PLANE1			= 0x3001,
196
+	GL_CLIP_PLANE2			= 0x3002,
197
+	GL_CLIP_PLANE3			= 0x3003,
198
+	GL_CLIP_PLANE4			= 0x3004,
199
+	GL_CLIP_PLANE5			= 0x3005,
200
+
201
+	/* Accumulation buffer */
202
+	GL_ACCUM_RED_BITS		= 0x0D58,
203
+	GL_ACCUM_GREEN_BITS		= 0x0D59,
204
+	GL_ACCUM_BLUE_BITS		= 0x0D5A,
205
+	GL_ACCUM_ALPHA_BITS		= 0x0D5B,
206
+	GL_ACCUM_CLEAR_VALUE		= 0x0B80,
207
+	GL_ACCUM			= 0x0100,
208
+	GL_ADD				= 0x0104,
209
+	GL_LOAD				= 0x0101,
210
+	GL_MULT				= 0x0103,
211
+	GL_RETURN			= 0x0102,
212
+
213
+	/* Alpha testing */
214
+	GL_ALPHA_TEST			= 0x0BC0,
215
+	GL_ALPHA_TEST_REF		= 0x0BC2,
216
+	GL_ALPHA_TEST_FUNC		= 0x0BC1,
217
+
218
+	/* Blending */
219
+	GL_BLEND			= 0x0BE2,
220
+	GL_BLEND_SRC			= 0x0BE1,
221
+	GL_BLEND_DST			= 0x0BE0,
222
+	GL_ZERO				= 0,
223
+	GL_ONE				= 1,
224
+	GL_SRC_COLOR			= 0x0300,
225
+	GL_ONE_MINUS_SRC_COLOR		= 0x0301,
226
+	GL_DST_COLOR			= 0x0306,
227
+	GL_ONE_MINUS_DST_COLOR		= 0x0307,
228
+	GL_SRC_ALPHA			= 0x0302,
229
+	GL_ONE_MINUS_SRC_ALPHA		= 0x0303,
230
+	GL_DST_ALPHA			= 0x0304,
231
+	GL_ONE_MINUS_DST_ALPHA		= 0x0305,
232
+	GL_SRC_ALPHA_SATURATE		= 0x0308,
233
+	GL_CONSTANT_COLOR		= 0x8001,
234
+	GL_ONE_MINUS_CONSTANT_COLOR	= 0x8002,
235
+	GL_CONSTANT_ALPHA		= 0x8003,
236
+	GL_ONE_MINUS_CONSTANT_ALPHA	= 0x8004,
237
+
238
+	/* Render Mode */
239
+	GL_FEEDBACK			= 0x1C01,
240
+	GL_RENDER			= 0x1C00,
241
+	GL_SELECT			= 0x1C02,
242
+
243
+	/* Feedback */
244
+	GL_2D				= 0x0600,
245
+	GL_3D				= 0x0601,
246
+	GL_3D_COLOR			= 0x0602,
247
+	GL_3D_COLOR_TEXTURE		= 0x0603,
248
+	GL_4D_COLOR_TEXTURE		= 0x0604,
249
+	GL_POINT_TOKEN			= 0x0701,
250
+	GL_LINE_TOKEN			= 0x0702,
251
+	GL_LINE_RESET_TOKEN		= 0x0707,
252
+	GL_POLYGON_TOKEN		= 0x0703,
253
+	GL_BITMAP_TOKEN			= 0x0704,
254
+	GL_DRAW_PIXEL_TOKEN		= 0x0705,
255
+	GL_COPY_PIXEL_TOKEN		= 0x0706,
256
+	GL_PASS_THROUGH_TOKEN		= 0x0700,
257
+
258
+	/* Fog */
259
+	GL_FOG				= 0x0B60,
260
+	GL_FOG_MODE			= 0x0B65,
261
+	GL_FOG_DENSITY			= 0x0B62,
262
+	GL_FOG_COLOR			= 0x0B66,
263
+	GL_FOG_INDEX			= 0x0B61,
264
+	GL_FOG_START			= 0x0B63,
265
+	GL_FOG_END			= 0x0B64,
266
+	GL_LINEAR			= 0x2601,
267
+	GL_EXP				= 0x0800,
268
+	GL_EXP2				= 0x0801,
269
+
270
+	/* Logic Ops */
271
+	GL_LOGIC_OP			= 0x0BF1,
272
+	GL_LOGIC_OP_MODE		= 0x0BF0,
273
+	GL_CLEAR			= 0x1500,
274
+	GL_SET				= 0x150F,
275
+	GL_COPY				= 0x1503,
276
+	GL_COPY_INVERTED		= 0x150C,
277
+	GL_NOOP				= 0x1505,
278
+	GL_INVERT			= 0x150A,
279
+	GL_AND				= 0x1501,
280
+	GL_NAND				= 0x150E,
281
+	GL_OR				= 0x1507,
282
+	GL_NOR				= 0x1508,
283
+	GL_XOR				= 0x1506,
284
+	GL_EQUIV			= 0x1509,
285
+	GL_AND_REVERSE			= 0x1502,
286
+	GL_AND_INVERTED			= 0x1504,
287
+	GL_OR_REVERSE			= 0x150B,
288
+	GL_OR_INVERTED			= 0x150D,
289
+
290
+	/* Stencil */
291
+	GL_STENCIL_TEST			= 0x0B90,
292
+	GL_STENCIL_WRITEMASK		= 0x0B98,
293
+	GL_STENCIL_BITS			= 0x0D57,
294
+	GL_STENCIL_FUNC			= 0x0B92,
295
+	GL_STENCIL_VALUE_MASK		= 0x0B93,
296
+	GL_STENCIL_REF			= 0x0B97,
297
+	GL_STENCIL_FAIL			= 0x0B94,
298
+	GL_STENCIL_PASS_DEPTH_PASS	= 0x0B96,
299
+	GL_STENCIL_PASS_DEPTH_FAIL	= 0x0B95,
300
+	GL_STENCIL_CLEAR_VALUE		= 0x0B91,
301
+	GL_STENCIL_INDEX		= 0x1901,
302
+	GL_KEEP				= 0x1E00,
303
+	GL_REPLACE			= 0x1E01,
304
+	GL_INCR				= 0x1E02,
305
+	GL_DECR				= 0x1E03,
306
+
307
+	/* Buffers, Pixel Drawing/Reading */
308
+	GL_NONE				= 0,
309
+	GL_LEFT				= 0x0406,
310
+	GL_RIGHT			= 0x0407,
311
+	/*GL_FRONT			= 0x0404, */
312
+	/*GL_BACK			= 0x0405, */
313
+	/*GL_FRONT_AND_BACK		= 0x0408, */
314
+	GL_FRONT_LEFT			= 0x0400,
315
+	GL_FRONT_RIGHT			= 0x0401,
316
+	GL_BACK_LEFT			= 0x0402,
317
+	GL_BACK_RIGHT			= 0x0403,
318
+	GL_AUX0				= 0x0409,
319
+	GL_AUX1				= 0x040A,
320
+	GL_AUX2				= 0x040B,
321
+	GL_AUX3				= 0x040C,
322
+	GL_COLOR_INDEX			= 0x1900,
323
+	GL_RED				= 0x1903,
324
+	GL_GREEN			= 0x1904,
325
+	GL_BLUE				= 0x1905,
326
+	GL_ALPHA			= 0x1906,
327
+	GL_LUMINANCE			= 0x1909,
328
+	GL_LUMINANCE_ALPHA		= 0x190A,
329
+	GL_ALPHA_BITS			= 0x0D55,
330
+	GL_RED_BITS			= 0x0D52,
331
+	GL_GREEN_BITS			= 0x0D53,
332
+	GL_BLUE_BITS			= 0x0D54,
333
+	GL_INDEX_BITS			= 0x0D51,
334
+	GL_SUBPIXEL_BITS		= 0x0D50,
335
+	GL_AUX_BUFFERS			= 0x0C00,
336
+	GL_READ_BUFFER			= 0x0C02,
337
+	GL_DRAW_BUFFER			= 0x0C01,
338
+	GL_DOUBLEBUFFER			= 0x0C32,
339
+	GL_STEREO			= 0x0C33,
340
+	GL_BITMAP			= 0x1A00,
341
+	GL_COLOR			= 0x1800,
342
+	GL_DEPTH			= 0x1801,
343
+	GL_STENCIL			= 0x1802,
344
+	GL_DITHER			= 0x0BD0,
345
+	GL_RGB				= 0x1907,
346
+	GL_RGBA				= 0x1908,
347
+
348
+	/* Implementation limits */
349
+	GL_MAX_LIST_NESTING		= 0x0B31,
350
+	GL_MAX_ATTRIB_STACK_DEPTH	= 0x0D35,
351
+	GL_MAX_MODELVIEW_STACK_DEPTH	= 0x0D36,
352
+	GL_MAX_NAME_STACK_DEPTH		= 0x0D37,
353
+	GL_MAX_PROJECTION_STACK_DEPTH	= 0x0D38,
354
+	GL_MAX_TEXTURE_STACK_DEPTH	= 0x0D39,
355
+	GL_MAX_EVAL_ORDER		= 0x0D30,
356
+	GL_MAX_LIGHTS			= 0x0D31,
357
+	GL_MAX_CLIP_PLANES		= 0x0D32,
358
+	GL_MAX_TEXTURE_SIZE		= 0x0D33,
359
+	GL_MAX_PIXEL_MAP_TABLE		= 0x0D34,
360
+	GL_MAX_VIEWPORT_DIMS		= 0x0D3A,
361
+	GL_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B,
362
+
363
+	/* Gets */
364
+	GL_ATTRIB_STACK_DEPTH		= 0x0BB0,
365
+	GL_COLOR_CLEAR_VALUE		= 0x0C22,
366
+	GL_COLOR_WRITEMASK		= 0x0C23,
367
+	GL_CURRENT_INDEX		= 0x0B01,
368
+	GL_CURRENT_COLOR		= 0x0B00,
369
+	GL_CURRENT_NORMAL		= 0x0B02,
370
+	GL_CURRENT_RASTER_COLOR		= 0x0B04,
371
+	GL_CURRENT_RASTER_DISTANCE	= 0x0B09,
372
+	GL_CURRENT_RASTER_INDEX		= 0x0B05,
373
+	GL_CURRENT_RASTER_POSITION	= 0x0B07,
374
+	GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06,
375
+	GL_CURRENT_RASTER_POSITION_VALID = 0x0B08,
376
+	GL_CURRENT_TEXTURE_COORDS	= 0x0B03,
377
+	GL_INDEX_CLEAR_VALUE		= 0x0C20,
378
+	GL_INDEX_MODE			= 0x0C30,
379
+	GL_INDEX_WRITEMASK		= 0x0C21,
380
+	GL_MODELVIEW_MATRIX		= 0x0BA6,
381
+	GL_MODELVIEW_STACK_DEPTH	= 0x0BA3,
382
+	GL_NAME_STACK_DEPTH		= 0x0D70,
383
+	GL_PROJECTION_MATRIX		= 0x0BA7,
384
+	GL_PROJECTION_STACK_DEPTH	= 0x0BA4,
385
+	GL_RENDER_MODE			= 0x0C40,
386
+	GL_RGBA_MODE			= 0x0C31,
387
+	GL_TEXTURE_MATRIX		= 0x0BA8,
388
+	GL_TEXTURE_STACK_DEPTH		= 0x0BA5,
389
+	GL_VIEWPORT			= 0x0BA2,
390
+
391
+
392
+	/* Evaluators */
393
+	GL_AUTO_NORMAL			= 0x0D80,
394
+	GL_MAP1_COLOR_4			= 0x0D90,
395
+	GL_MAP1_GRID_DOMAIN		= 0x0DD0,
396
+	GL_MAP1_GRID_SEGMENTS		= 0x0DD1,
397
+	GL_MAP1_INDEX			= 0x0D91,
398
+	GL_MAP1_NORMAL			= 0x0D92,
399
+	GL_MAP1_TEXTURE_COORD_1		= 0x0D93,
400
+	GL_MAP1_TEXTURE_COORD_2		= 0x0D94,
401
+	GL_MAP1_TEXTURE_COORD_3		= 0x0D95,
402
+	GL_MAP1_TEXTURE_COORD_4		= 0x0D96,
403
+	GL_MAP1_VERTEX_3		= 0x0D97,
404
+	GL_MAP1_VERTEX_4		= 0x0D98,
405
+	GL_MAP2_COLOR_4			= 0x0DB0,
406
+	GL_MAP2_GRID_DOMAIN		= 0x0DD2,
407
+	GL_MAP2_GRID_SEGMENTS		= 0x0DD3,
408
+	GL_MAP2_INDEX			= 0x0DB1,
409
+	GL_MAP2_NORMAL			= 0x0DB2,
410
+	GL_MAP2_TEXTURE_COORD_1		= 0x0DB3,
411
+	GL_MAP2_TEXTURE_COORD_2		= 0x0DB4,
412
+	GL_MAP2_TEXTURE_COORD_3		= 0x0DB5,
413
+	GL_MAP2_TEXTURE_COORD_4		= 0x0DB6,
414
+	GL_MAP2_VERTEX_3		= 0x0DB7,
415
+	GL_MAP2_VERTEX_4		= 0x0DB8,
416
+	GL_COEFF			= 0x0A00,
417
+	GL_DOMAIN			= 0x0A02,
418
+	GL_ORDER			= 0x0A01,
419
+
420
+	/* Hints */
421
+	GL_FOG_HINT			= 0x0C54,
422
+	GL_LINE_SMOOTH_HINT		= 0x0C52,
423
+	GL_PERSPECTIVE_CORRECTION_HINT	= 0x0C50,
424
+	GL_POINT_SMOOTH_HINT		= 0x0C51,
425
+	GL_POLYGON_SMOOTH_HINT		= 0x0C53,
426
+	GL_DONT_CARE			= 0x1100,
427
+	GL_FASTEST			= 0x1101,
428
+	GL_NICEST			= 0x1102,
429
+
430
+	/* Scissor box */
431
+	GL_SCISSOR_TEST			= 0x0C11,
432
+	GL_SCISSOR_BOX			= 0x0C10,
433
+
434
+	/* Pixel Mode / Transfer */
435
+	GL_MAP_COLOR			= 0x0D10,
436
+	GL_MAP_STENCIL			= 0x0D11,
437
+	GL_INDEX_SHIFT			= 0x0D12,
438
+	GL_INDEX_OFFSET			= 0x0D13,
439
+	GL_RED_SCALE			= 0x0D14,
440
+	GL_RED_BIAS			= 0x0D15,
441
+	GL_GREEN_SCALE			= 0x0D18,
442
+	GL_GREEN_BIAS			= 0x0D19,
443
+	GL_BLUE_SCALE			= 0x0D1A,
444
+	GL_BLUE_BIAS			= 0x0D1B,
445
+	GL_ALPHA_SCALE			= 0x0D1C,
446
+	GL_ALPHA_BIAS			= 0x0D1D,
447
+	GL_DEPTH_SCALE			= 0x0D1E,
448
+	GL_DEPTH_BIAS			= 0x0D1F,
449
+	GL_PIXEL_MAP_S_TO_S_SIZE	= 0x0CB1,
450
+	GL_PIXEL_MAP_I_TO_I_SIZE	= 0x0CB0,
451
+	GL_PIXEL_MAP_I_TO_R_SIZE	= 0x0CB2,
452
+	GL_PIXEL_MAP_I_TO_G_SIZE	= 0x0CB3,
453
+	GL_PIXEL_MAP_I_TO_B_SIZE	= 0x0CB4,
454
+	GL_PIXEL_MAP_I_TO_A_SIZE	= 0x0CB5,
455
+	GL_PIXEL_MAP_R_TO_R_SIZE	= 0x0CB6,
456
+	GL_PIXEL_MAP_G_TO_G_SIZE	= 0x0CB7,
457
+	GL_PIXEL_MAP_B_TO_B_SIZE	= 0x0CB8,
458
+	GL_PIXEL_MAP_A_TO_A_SIZE	= 0x0CB9,
459
+	GL_PIXEL_MAP_S_TO_S		= 0x0C71,
460
+	GL_PIXEL_MAP_I_TO_I		= 0x0C70,
461
+	GL_PIXEL_MAP_I_TO_R		= 0x0C72,
462
+	GL_PIXEL_MAP_I_TO_G		= 0x0C73,
463
+	GL_PIXEL_MAP_I_TO_B		= 0x0C74,
464
+	GL_PIXEL_MAP_I_TO_A		= 0x0C75,
465
+	GL_PIXEL_MAP_R_TO_R		= 0x0C76,
466
+	GL_PIXEL_MAP_G_TO_G		= 0x0C77,
467
+	GL_PIXEL_MAP_B_TO_B		= 0x0C78,
468
+	GL_PIXEL_MAP_A_TO_A		= 0x0C79,
469
+	GL_PACK_ALIGNMENT		= 0x0D05,
470
+	GL_PACK_LSB_FIRST		= 0x0D01,
471
+	GL_PACK_ROW_LENGTH		= 0x0D02,
472
+	GL_PACK_SKIP_PIXELS		= 0x0D04,
473
+	GL_PACK_SKIP_ROWS		= 0x0D03,
474
+	GL_PACK_SWAP_BYTES		= 0x0D00,
475
+	GL_UNPACK_ALIGNMENT		= 0x0CF5,
476
+	GL_UNPACK_LSB_FIRST		= 0x0CF1,
477
+	GL_UNPACK_ROW_LENGTH		= 0x0CF2,
478
+	GL_UNPACK_SKIP_PIXELS		= 0x0CF4,
479
+	GL_UNPACK_SKIP_ROWS		= 0x0CF3,
480
+	GL_UNPACK_SWAP_BYTES		= 0x0CF0,
481
+	GL_ZOOM_X			= 0x0D16,
482
+	GL_ZOOM_Y			= 0x0D17,
483
+
484
+	/* Texture mapping */
485
+	GL_TEXTURE_ENV			= 0x2300,
486
+	GL_TEXTURE_ENV_MODE		= 0x2200,
487
+	GL_TEXTURE_1D			= 0x0DE0,
488
+	GL_TEXTURE_2D			= 0x0DE1,
489
+	GL_TEXTURE_WRAP_S		= 0x2802,
490
+	GL_TEXTURE_WRAP_T		= 0x2803,
491
+	GL_TEXTURE_MAG_FILTER		= 0x2800,
492
+	GL_TEXTURE_MIN_FILTER		= 0x2801,
493
+	GL_TEXTURE_ENV_COLOR		= 0x2201,
494
+	GL_TEXTURE_GEN_S		= 0x0C60,
495
+	GL_TEXTURE_GEN_T		= 0x0C61,
496
+	GL_TEXTURE_GEN_MODE		= 0x2500,
497
+	GL_TEXTURE_BORDER_COLOR		= 0x1004,
498
+	GL_TEXTURE_WIDTH		= 0x1000,
499
+	GL_TEXTURE_HEIGHT		= 0x1001,
500
+	GL_TEXTURE_BORDER		= 0x1005,
501
+	GL_TEXTURE_COMPONENTS		= 0x1003,
502
+	GL_NEAREST_MIPMAP_NEAREST	= 0x2700,
503
+	GL_NEAREST_MIPMAP_LINEAR	= 0x2702,
504
+	GL_LINEAR_MIPMAP_NEAREST	= 0x2701,
505
+	GL_LINEAR_MIPMAP_LINEAR		= 0x2703,
506
+	GL_OBJECT_LINEAR		= 0x2401,
507
+	GL_OBJECT_PLANE			= 0x2501,
508
+	GL_EYE_LINEAR			= 0x2400,
509
+	GL_EYE_PLANE			= 0x2502,
510
+	GL_SPHERE_MAP			= 0x2402,
511
+	GL_DECAL			= 0x2101,
512
+	GL_MODULATE			= 0x2100,
513
+	GL_NEAREST			= 0x2600,
514
+	GL_REPEAT			= 0x2901,
515
+	GL_CLAMP			= 0x2900,
516
+	GL_S				= 0x2000,
517
+	GL_T				= 0x2001,
518
+	GL_R				= 0x2002,
519
+	GL_Q				= 0x2003,
520
+	GL_TEXTURE_GEN_R		= 0x0C62,
521
+	GL_TEXTURE_GEN_Q		= 0x0C63,
522
+
523
+	GL_PROXY_TEXTURE_1D		= 0x8063,
524
+	GL_PROXY_TEXTURE_2D		= 0x8064,
525
+	GL_TEXTURE_PRIORITY		= 0x8066,
526
+	GL_TEXTURE_RESIDENT		= 0x8067,
527
+	GL_TEXTURE_1D_BINDING		= 0x8068,
528
+	GL_TEXTURE_2D_BINDING		= 0x8069,
529
+
530
+	/* Internal texture formats */
531
+	GL_ALPHA4			= 0x803B,
532
+	GL_ALPHA8			= 0x803C,
533
+	GL_ALPHA12			= 0x803D,
534
+	GL_ALPHA16			= 0x803E,
535
+	GL_LUMINANCE4			= 0x803F,
536
+	GL_LUMINANCE8			= 0x8040,
537
+	GL_LUMINANCE12			= 0x8041,
538
+	GL_LUMINANCE16			= 0x8042,
539
+	GL_LUMINANCE4_ALPHA4		= 0x8043,
540
+	GL_LUMINANCE6_ALPHA2		= 0x8044,
541
+	GL_LUMINANCE8_ALPHA8		= 0x8045,
542
+	GL_LUMINANCE12_ALPHA4		= 0x8046,
543
+	GL_LUMINANCE12_ALPHA12		= 0x8047,
544
+	GL_LUMINANCE16_ALPHA16		= 0x8048,
545
+	GL_INTENSITY			= 0x8049,
546
+	GL_INTENSITY4			= 0x804A,
547
+	GL_INTENSITY8			= 0x804B,
548
+	GL_INTENSITY12			= 0x804C,
549
+	GL_INTENSITY16			= 0x804D,
550
+	GL_R3_G3_B2			= 0x2A10,
551
+	GL_RGB4				= 0x804F,
552
+	GL_RGB5				= 0x8050,
553
+	GL_RGB8				= 0x8051,
554
+	GL_RGB10			= 0x8052,
555
+	GL_RGB12			= 0x8053,
556
+	GL_RGB16			= 0x8054,
557
+	GL_RGBA2			= 0x8055,
558
+	GL_RGBA4			= 0x8056,
559
+	GL_RGB5_A1			= 0x8057,
560
+	GL_RGBA8			= 0x8058,
561
+	GL_RGB10_A2			= 0x8059,
562
+	GL_RGBA12			= 0x805A,
563
+	GL_RGBA16			= 0x805B,
564
+
565
+	/* Utility */
566
+	GL_VENDOR			= 0x1F00,
567
+	GL_RENDERER			= 0x1F01,
568
+	GL_VERSION			= 0x1F02,
569
+	GL_EXTENSIONS			= 0x1F03,
570
+
571
+	/* Errors */
572
+	GL_INVALID_VALUE		= 0x0501,
573
+	GL_INVALID_ENUM			= 0x0500,
574
+	GL_INVALID_OPERATION		= 0x0502,
575
+	GL_STACK_OVERFLOW		= 0x0503,
576
+	GL_STACK_UNDERFLOW		= 0x0504,
577
+	GL_OUT_OF_MEMORY		= 0x0505,
578
+
579
+	/*
580
+	 * 1.0 Extensions
581
+	 */
582
+        /* GL_EXT_blend_minmax and GL_EXT_blend_color */
583
+	GL_CONSTANT_COLOR_EXT		= 0x8001,
584
+	GL_ONE_MINUS_CONSTANT_COLOR_EXT	= 0x8002,
585
+	GL_CONSTANT_ALPHA_EXT		= 0x8003,
586
+	GL_ONE_MINUS_CONSTANT_ALPHA_EXT	= 0x8004,
587
+	GL_BLEND_EQUATION_EXT		= 0x8009,
588
+	GL_MIN_EXT			= 0x8007,
589
+	GL_MAX_EXT			= 0x8008,
590
+	GL_FUNC_ADD_EXT			= 0x8006,
591
+	GL_FUNC_SUBTRACT_EXT		= 0x800A,
592
+	GL_FUNC_REVERSE_SUBTRACT_EXT	= 0x800B,
593
+	GL_BLEND_COLOR_EXT		= 0x8005,
594
+
595
+	/* GL_EXT_polygon_offset */
596
+        GL_POLYGON_OFFSET_EXT           = 0x8037,
597
+        GL_POLYGON_OFFSET_FACTOR_EXT    = 0x8038,
598
+        GL_POLYGON_OFFSET_BIAS_EXT      = 0x8039,
599
+
600
+	/* GL_EXT_vertex_array */
601
+	GL_VERTEX_ARRAY_EXT		= 0x8074,
602
+	GL_NORMAL_ARRAY_EXT		= 0x8075,
603
+	GL_COLOR_ARRAY_EXT		= 0x8076,
604
+	GL_INDEX_ARRAY_EXT		= 0x8077,
605
+	GL_TEXTURE_COORD_ARRAY_EXT	= 0x8078,
606
+	GL_EDGE_FLAG_ARRAY_EXT		= 0x8079,
607
+	GL_VERTEX_ARRAY_SIZE_EXT	= 0x807A,
608
+	GL_VERTEX_ARRAY_TYPE_EXT	= 0x807B,
609
+	GL_VERTEX_ARRAY_STRIDE_EXT	= 0x807C,
610
+	GL_VERTEX_ARRAY_COUNT_EXT	= 0x807D,
611
+	GL_NORMAL_ARRAY_TYPE_EXT	= 0x807E,
612
+	GL_NORMAL_ARRAY_STRIDE_EXT	= 0x807F,