Subversion Repositories Kolibri OS

Rev

Rev 1789 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1789 Rev 5098
1
/*
1
/*
2
Ïðèìåð âçÿò èç íàáîðà ïðèìåðîâ áèáëèîòåêè Mesa
2
Ïðèìåð âçÿò èç íàáîðà ïðèìåðîâ áèáëèîòåêè Mesa
3
 
3
 
4
iadn
4
iadn
5
http://www.iadn.narod.ru
5
http://www.iadn.narod.ru
6
iadn@bk.ru
6
iadn@bk.ru
7
*/
7
*/
8
 
8
 
9
/*
9
/*
10
 * 3-D gear wheels.  This program is in the public domain.
10
 * 3-D gear wheels.  This program is in the public domain.
11
 *
11
 *
12
 * Brian Paul
12
 * Brian Paul
13
 */
13
 */
14
 
14
 
15
#include 
15
#include 
16
#include  //TinyGL
16
#include  //TinyGL
17
#include 
17
#include 
18
#include 
18
#include 
19
 
19
 
20
#include "SysCall.h"
20
#include "SysCall.h"
21
#include "ProcessTab.h"
21
#include "ProcessTab.h"
22
 
22
 
23
int Fps (long x, long y);
23
int Fps (long x, long y);
24
extern "C"{
24
extern "C"{
25
void app_main(void);
25
int main(void);
26
}
26
}
27
 
27
 
28
struct {
28
struct {
29
	   int x,y;
29
	   int x,y;
30
	   int dx,dy;
30
	   int dx,dy;
31
	   } win;
31
	   } win;
32
 
32
 
33
#define KEY_ESC       1
33
#define KEY_ESC       1
34
#define KEY_F     	 33
34
#define KEY_F     	 33
35
 
35
 
36
char *title1 = "TinyGL in KolibriOS";
36
char *title1 = "TinyGL in KolibriOS";
37
char *title2 = "F full screen";
37
char *title2 = "F full screen";
38
char *title3 = "ESC - exit";
38
char *title3 = "ESC - exit";
39
char *fps    = "FPS:";
39
char *fps    = "FPS:";
40
 
40
 
41
unsigned char FullScreen = 0;
41
unsigned char FullScreen = 0;
42
unsigned char skin = 3;
42
unsigned char skin = 3;
43
 
43
 
44
process_table_entry_* pri;
44
process_table_entry_* pri;
45
KOSGLContext cgl;
45
KOSGLContext cgl;
46
 
46
 
47
static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
47
static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
48
static GLint gear1, gear2, gear3;
48
static GLint gear1, gear2, gear3;
49
static GLfloat angle = 0.0;
49
static GLfloat angle = 0.0;
50
 
50
 
51
static GLuint limit;
51
static GLuint limit;
52
static GLuint count = 1;
52
static GLuint count = 1;
53
 
53
 
54
/*
54
/*
55
 * Draw a gear wheel.  You'll probably want to call this function when
55
 * Draw a gear wheel.  You'll probably want to call this function when
56
 * building a display list since we do a lot of trig here.
56
 * building a display list since we do a lot of trig here.
57
 *
57
 *
58
 * Input:  inner_radius - radius of hole at center
58
 * Input:  inner_radius - radius of hole at center
59
 *         outer_radius - radius at center of teeth
59
 *         outer_radius - radius at center of teeth
60
 *         width - width of gear
60
 *         width - width of gear
61
 *         teeth - number of teeth
61
 *         teeth - number of teeth
62
 *         tooth_depth - depth of tooth
62
 *         tooth_depth - depth of tooth
63
 */
63
 */
64
static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
64
static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
65
		  GLint teeth, GLfloat tooth_depth )
65
		  GLint teeth, GLfloat tooth_depth )
66
{
66
{
67
   GLint i;
67
   GLint i;
68
   GLfloat r0, r1, r2;
68
   GLfloat r0, r1, r2;
69
   GLfloat angle, da;
69
   GLfloat angle, da;
70
   GLfloat u, v, len;
70
   GLfloat u, v, len;
71
 
71
 
72
   r0 = inner_radius;
72
   r0 = inner_radius;
73
   r1 = outer_radius - tooth_depth/2.0;
73
   r1 = outer_radius - tooth_depth/2.0;
74
   r2 = outer_radius + tooth_depth/2.0;
74
   r2 = outer_radius + tooth_depth/2.0;
75
 
75
 
76
   da = 2.0*M_PI / teeth / 4.0;
76
   da = 2.0*M_PI / teeth / 4.0;
77
 
77
 
78
   glShadeModel( GL_FLAT );
78
   glShadeModel( GL_FLAT );
79
 
79
 
80
   glNormal3f( 0.0, 0.0, 1.0 );
80
   glNormal3f( 0.0, 0.0, 1.0 );
81
 
81
 
82
   /* draw front face */
82
   /* draw front face */
83
   glBegin( GL_QUAD_STRIP );
83
   glBegin( GL_QUAD_STRIP );
84
   for (i=0;i<=teeth;i++) {
84
   for (i=0;i<=teeth;i++) {
85
      angle = i * 2.0*M_PI / teeth;
85
      angle = i * 2.0*M_PI / teeth;
86
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
86
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
87
      glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
87
      glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
88
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
88
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
89
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
89
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
90
   }
90
   }
91
   glEnd();
91
   glEnd();
92
 
92
 
93
   /* draw front sides of teeth */
93
   /* draw front sides of teeth */
94
   glBegin( GL_QUADS );
94
   glBegin( GL_QUADS );
95
   da = 2.0*M_PI / teeth / 4.0;
95
   da = 2.0*M_PI / teeth / 4.0;
96
   for (i=0;i
96
   for (i=0;i
97
      angle = i * 2.0*M_PI / teeth;
97
      angle = i * 2.0*M_PI / teeth;
98
 
98
 
99
      glVertex3f( r1*cos(angle),      r1*sin(angle),      width*0.5 );
99
      glVertex3f( r1*cos(angle),      r1*sin(angle),      width*0.5 );
100
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   width*0.5 );
100
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   width*0.5 );
101
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
101
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
102
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
102
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
103
   }
103
   }
104
   glEnd();
104
   glEnd();
105
 
105
 
106
   glNormal3f( 0.0, 0.0, -1.0 );
106
   glNormal3f( 0.0, 0.0, -1.0 );
107
 
107
 
108
   /* draw back face */
108
   /* draw back face */
109
   glBegin( GL_QUAD_STRIP );
109
   glBegin( GL_QUAD_STRIP );
110
   for (i=0;i<=teeth;i++) {
110
   for (i=0;i<=teeth;i++) {
111
      angle = i * 2.0*M_PI / teeth;
111
      angle = i * 2.0*M_PI / teeth;
112
      glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
112
      glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
113
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
113
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
114
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
114
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
115
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
115
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
116
   }
116
   }
117
   glEnd();
117
   glEnd();
118
 
118
 
119
   /* draw back sides of teeth */
119
   /* draw back sides of teeth */
120
   glBegin( GL_QUADS );
120
   glBegin( GL_QUADS );
121
   da = 2.0*M_PI / teeth / 4.0;
121
   da = 2.0*M_PI / teeth / 4.0;
122
   for (i=0;i
122
   for (i=0;i
123
      angle = i * 2.0*M_PI / teeth;
123
      angle = i * 2.0*M_PI / teeth;
124
 
124
 
125
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
125
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
126
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
126
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
127
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
127
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
128
      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
128
      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
129
   }
129
   }
130
   glEnd();
130
   glEnd();
131
 
131
 
132
   /* draw outward faces of teeth */
132
   /* draw outward faces of teeth */
133
   glBegin( GL_QUAD_STRIP );
133
   glBegin( GL_QUAD_STRIP );
134
   for (i=0;i
134
   for (i=0;i
135
      angle = i * 2.0*M_PI / teeth;
135
      angle = i * 2.0*M_PI / teeth;
136
 
136
 
137
      glVertex3f( r1*cos(angle),      r1*sin(angle),       width*0.5 );
137
      glVertex3f( r1*cos(angle),      r1*sin(angle),       width*0.5 );
138
      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
138
      glVertex3f( r1*cos(angle),      r1*sin(angle),      -width*0.5 );
139
      u = r2*cos(angle+da) - r1*cos(angle);
139
      u = r2*cos(angle+da) - r1*cos(angle);
140
      v = r2*sin(angle+da) - r1*sin(angle);
140
      v = r2*sin(angle+da) - r1*sin(angle);
141
      len = sqrt( u*u + v*v );
141
      len = sqrt( u*u + v*v );
142
      u /= len;
142
      u /= len;
143
      v /= len;
143
      v /= len;
144
      glNormal3f( v, -u, 0.0 );
144
      glNormal3f( v, -u, 0.0 );
145
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),    width*0.5 );
145
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),    width*0.5 );
146
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
146
      glVertex3f( r2*cos(angle+da),   r2*sin(angle+da),   -width*0.5 );
147
      glNormal3f( cos(angle), sin(angle), 0.0 );
147
      glNormal3f( cos(angle), sin(angle), 0.0 );
148
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da),  width*0.5 );
148
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da),  width*0.5 );
149
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
149
      glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
150
      u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
150
      u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
151
      v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
151
      v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
152
      glNormal3f( v, -u, 0.0 );
152
      glNormal3f( v, -u, 0.0 );
153
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da),  width*0.5 );
153
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da),  width*0.5 );
154
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
154
      glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
155
      glNormal3f( cos(angle), sin(angle), 0.0 );
155
      glNormal3f( cos(angle), sin(angle), 0.0 );
156
   }
156
   }
157
 
157
 
158
   glVertex3f( r1*cos(0.0), r1*sin(0.0), width*0.5 );
158
   glVertex3f( r1*cos(0.0), r1*sin(0.0), width*0.5 );
159
   glVertex3f( r1*cos(0.0), r1*sin(0.0), -width*0.5 );
159
   glVertex3f( r1*cos(0.0), r1*sin(0.0), -width*0.5 );
160
 
160
 
161
   glEnd();
161
   glEnd();
162
 
162
 
163
   glShadeModel( GL_SMOOTH );
163
   glShadeModel( GL_SMOOTH );
164
 
164
 
165
   /* draw inside radius cylinder */
165
   /* draw inside radius cylinder */
166
   glBegin( GL_QUAD_STRIP );
166
   glBegin( GL_QUAD_STRIP );
167
   for (i=0;i<=teeth;i++) {
167
   for (i=0;i<=teeth;i++) {
168
      angle = i * 2.0*M_PI / teeth;
168
      angle = i * 2.0*M_PI / teeth;
169
      glNormal3f( -cos(angle), -sin(angle), 0.0 );
169
      glNormal3f( -cos(angle), -sin(angle), 0.0 );
170
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
170
      glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
171
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
171
      glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
172
   }
172
   }
173
   glEnd();      
173
   glEnd();      
174
}
174
}
175
 
175
 
176
void init( void )
176
void init( void )
177
{
177
{
178
   static GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 };
178
   static GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 };
179
   static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
179
   static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
180
   static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
180
   static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
181
   static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
181
   static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
182
 
182
 
183
   glLightfv( GL_LIGHT0, GL_POSITION, pos );
183
   glLightfv( GL_LIGHT0, GL_POSITION, pos );
184
   glEnable( GL_CULL_FACE );
184
   glEnable( GL_CULL_FACE );
185
   glEnable( GL_LIGHTING );
185
   glEnable( GL_LIGHTING );
186
   glEnable( GL_LIGHT0 );
186
   glEnable( GL_LIGHT0 );
187
   glEnable( GL_DEPTH_TEST );
187
   glEnable( GL_DEPTH_TEST );
188
 
188
 
189
   /* make the gears */
189
   /* make the gears */
190
   gear1 = glGenLists(1);
190
   gear1 = glGenLists(1);
191
   glNewList(gear1, GL_COMPILE);
191
   glNewList(gear1, GL_COMPILE);
192
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
192
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
193
   gear( 1.0, 4.0, 1.0, 20, 0.7 );
193
   gear( 1.0, 4.0, 1.0, 20, 0.7 );
194
   glEndList();
194
   glEndList();
195
 
195
 
196
   gear2 = glGenLists(1);
196
   gear2 = glGenLists(1);
197
   glNewList(gear2, GL_COMPILE);
197
   glNewList(gear2, GL_COMPILE);
198
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
198
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
199
   gear( 0.5, 2.0, 2.0, 10, 0.7 );
199
   gear( 0.5, 2.0, 2.0, 10, 0.7 );
200
   glEndList();
200
   glEndList();
201
 
201
 
202
   gear3 = glGenLists(1);
202
   gear3 = glGenLists(1);
203
   glNewList(gear3, GL_COMPILE);
203
   glNewList(gear3, GL_COMPILE);
204
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
204
   glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
205
   gear( 1.3, 2.0, 0.5, 10, 0.7 );
205
   gear( 1.3, 2.0, 0.5, 10, 0.7 );
206
   glEndList();
206
   glEndList();
207
 
207
 
208
   glEnable( GL_NORMALIZE );
208
   glEnable( GL_NORMALIZE );
209
   
209
   
210
   glViewport(0, 0, (GLint)500, (GLint)480);
210
   glViewport(0, 0, (GLint)500, (GLint)480);
211
   glMatrixMode(GL_PROJECTION);
211
   glMatrixMode(GL_PROJECTION);
212
   glLoadIdentity();
212
   glLoadIdentity();
213
   glFrustum( -1.0, 1.0, -1, 1, 5.0, 60.0 );
213
   glFrustum( -1.0, 1.0, -1, 1, 5.0, 60.0 );
214
   glMatrixMode(GL_MODELVIEW);
214
   glMatrixMode(GL_MODELVIEW);
215
   glLoadIdentity();
215
   glLoadIdentity();
216
   glTranslatef( 0.0, 0.0, -40.0 );
216
   glTranslatef( 0.0, 0.0, -40.0 );
217
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );   
217
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );   
218
}
218
}
219
 
219
 
220
void reshape()
220
void reshape()
221
{   
221
{   
222
   __menuet__get_process_table((process_table_entry*)pri,-1);
222
   __menuet__get_process_table((process_table_entry*)pri,-1);
223
   glViewport(0, 0, pri->winx_size, pri->winy_size-20);
223
   glViewport(0, 0, pri->winx_size, pri->winy_size-20);
224
   glMatrixMode(GL_PROJECTION);
224
   glMatrixMode(GL_PROJECTION);
225
   glLoadIdentity();
225
   glLoadIdentity();
226
   gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 60.0);
226
   gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 60.0);
227
   glTranslatef( 0.0, 0.0, 20.0 );
227
   glTranslatef( 0.0, 0.0, 20.0 );
228
   glMatrixMode(GL_MODELVIEW);
228
   glMatrixMode(GL_MODELVIEW);
229
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );     
229
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );     
230
}
230
}
231
 
231
 
232
void disabletgl()
232
void disabletgl()
233
{
233
{
234
	kosglDestroyContext(cgl); 
234
	kosglDestroyContext(cgl); 
235
	delete pri;
235
	delete pri;
236
}
236
}
237
 
237
 
238
void Title()
238
void Title()
239
{
239
{
240
     __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps));
240
     __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps));
241
     __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1));
241
     __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1));
242
	 __menuet__write_text(180,8,0x00ffffff,title2,strlen(title2));
242
	 __menuet__write_text(180,8,0x00ffffff,title2,strlen(title2));
243
     __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3));
243
     __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3));
244
}
244
}
245
 
245
 
246
void draw_window(void)
246
void draw_window(void)
247
{
247
{
248
	// start redraw
248
	// start redraw
249
	__menuet__window_redraw(1);
249
	__menuet__window_redraw(1);
250
	// define&draw window
250
	// define&draw window
251
	__menuet__define_window(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,0);
251
	__menuet__define_window(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,0);
252
    // end redraw
252
    // end redraw
253
    __menuet__window_redraw(2);
253
    __menuet__window_redraw(2);
254
    // display string
254
    // display string
255
    Title();
255
    Title();
256
}
256
}
257
 
257
 
258
void app_main(void)          
258
int main(void)          
259
{
259
{
260
 
260
 
261
  win.x = 100;
261
  win.x = 100;
262
  win.y = 100;
262
  win.y = 100;
263
  win.dx = 400;
263
  win.dx = 400;
264
  win.dy = 400;	 
264
  win.dy = 400;	 
265
 
265
 
266
  draw_window();
266
  draw_window();
267
 
267
 
268
  cgl = kosglCreateContext( 0, 0);
268
  cgl = kosglCreateContext( 0, 0);
269
  kosglMakeCurrent( 0, 20, win.dx, win.dy-20, cgl);
269
  kosglMakeCurrent( 0, 20, win.dx, win.dy-20, cgl);
270
 
270
 
271
  init();
271
  init();
272
 
272
 
273
  pri=new process_table_entry_;
273
  pri=new process_table_entry_;
274
  SysCall(66,1,1);
274
  SysCall(66,1,1);
275
 
275
 
276
  reshape();
276
  reshape();
277
  
277
  
278
do{
278
do{
279
 
279
 
280
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
280
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
281
 
281
 
282
   glPushMatrix();
282
   glPushMatrix();
283
   glRotatef( view_rotx, 1.0, 0.0, 0.0 );
283
   glRotatef( view_rotx, 1.0, 0.0, 0.0 );
284
   glRotatef( view_roty, 0.0, 1.0, 0.0 );
284
   glRotatef( view_roty, 0.0, 1.0, 0.0 );
285
   glRotatef( view_rotz, 0.0, 0.0, 1.0 );
285
   glRotatef( view_rotz, 0.0, 0.0, 1.0 );
286
 
286
 
287
   glPushMatrix();
287
   glPushMatrix();
288
   glTranslatef( -2.0, -2.0, 0.0 );
288
   glTranslatef( -2.0, -2.0, 0.0 );
289
   glRotatef( angle, 0.0, 0.0, 1.0 );
289
   glRotatef( angle, 0.0, 0.0, 1.0 );
290
   glCallList(gear1);
290
   glCallList(gear1);
291
   glPopMatrix();
291
   glPopMatrix();
292
 
292
 
293
   glPushMatrix();
293
   glPushMatrix();
294
   glTranslatef( 4.1, -2.0, 0.0 );
294
   glTranslatef( 4.1, -2.0, 0.0 );
295
   glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
295
   glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
296
   glCallList(gear2);
296
   glCallList(gear2);
297
   glPopMatrix();
297
   glPopMatrix();
298
 
298
 
299
   glPushMatrix();
299
   glPushMatrix();
300
   glTranslatef( -2.1, 4.2, 0.0 );
300
   glTranslatef( -2.1, 4.2, 0.0 );
301
   glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
301
   glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
302
   glCallList(gear3);
302
   glCallList(gear3);
303
   glPopMatrix();
303
   glPopMatrix();
304
 
304
 
305
   glPopMatrix();
305
   glPopMatrix();
306
   
306
   
307
 kosglSwapBuffers();
307
 kosglSwapBuffers();
308
 
308
 
309
 angle += 0.01 + 0.3* Fps (330,8);
309
 angle += 0.01 + 0.3* Fps (330,8);
310
 			
310
 			
311
		  switch(SysCall(11))
311
		  switch(SysCall(11))
312
		      {
312
		      {
313
		          case 1: draw_window();				  	   	  
313
		          case 1: draw_window();				  	   	  
314
				  	   	  reshape();
314
				  	   	  reshape();
315
				  	   	  break;
315
				  	   	  break;
316
				  	   	  
316
				  	   	  
317
		          case 2: 		          
317
		          case 2: 		          
318
		          	   switch(__menuet__getkey()){
318
		          	   switch(__menuet__getkey()){
319
 
319
 
320
						   case KEY_F:
320
						   case KEY_F:
321
                                    if(!FullScreen){									 
321
                                    if(!FullScreen){									 
322
									 skin=0;
322
									 skin=0;
323
									 SysCall(67,0,0,SysCall(14)>>16,SysCall(14)&0xffff);
323
									 SysCall(67,0,0,SysCall(14)>>16,SysCall(14)&0xffff);
324
									 draw_window();
324
									 draw_window();
325
									 reshape();
325
									 reshape();
326
									 FullScreen = 1;
326
									 FullScreen = 1;
327
									}
327
									}
328
									else{
328
									else{
329
									 skin=3;
329
									 skin=3;
330
									 draw_window();
330
									 draw_window();
331
									 SysCall(67,win.x,win.y,win.dx,win.dy);
331
									 SysCall(67,win.x,win.y,win.dx,win.dy);
332
									 reshape();
332
									 reshape();
333
									 FullScreen = 0;
333
									 FullScreen = 0;
334
									};
334
									};
335
						  			break;
335
						  			break;
336
		          
336
		          
337
                           case KEY_ESC: disabletgl();
337
                           case KEY_ESC: disabletgl();
338
						  				 return;}
338
						  				 return 0;}
339
						  				 break;
339
						  				 break;
340
						  			
340
						  			
341
			  	  case 3: disabletgl();
341
			  	  case 3: disabletgl();
342
						  return;
342
						  return 0;
343
		      }
343
		      }
344
}while(1);
344
}while(1);
345
}
345
}