3 Copyright (C) 2001-2003 Paolo Martella
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
29 static Texture
* k_Text
;
30 static GLuint numtexs
=7;
31 static GLuint width
=800;
32 static GLuint height
=600;
33 static bool init
=true;
34 static GLfloat k_time
=0;
36 static GLfloat k_timer
;
40 k_Text
=new Texture
[numtexs
];
41 glMatrixMode(GL_PROJECTION
);
43 gluPerspective(45.0f
,(GLfloat
)width
/(GLfloat
)height
,0.1f
,100.0f
);
44 glMatrixMode(GL_MODELVIEW
);
47 k_Text
[1].Load("data/glxcess.raw");
48 k_Text
[2].Load("data/cl.raw");
49 k_Text
[3].Load("data/glxcesss.raw");
50 k_Text
[4].Load("data/crite.raw");
51 k_Text
[5].Load("data/lightmask.raw");
52 k_Text
[6].Load("data/cl2.raw");
53 glShadeModel(GL_FLAT
);
54 glClearColor(.5f
, 0.3f
, 0.2f
, 0.0f
);
55 glClearColor(.0f
, .0f
, .0f
, 0.0f
);
57 glDisable(GL_DEPTH_TEST
);
58 glDisable (GL_CULL_FACE
);
59 glHint(GL_PERSPECTIVE_CORRECTION_HINT
, GL_NICEST
);
60 glPolygonMode(GL_FRONT
, GL_FILL
);
62 glEnable(GL_TEXTURE_2D
);
63 glDisable(GL_LIGHTING
);
65 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
80 void k_drawrect(GLfloat b
,GLfloat h
)
83 glTexCoord2f(0.0f
,0.0f
);
84 glVertex3f(-b
/2,-h
/2,0.0f
);
85 glTexCoord2f(1.0f
,0.0f
);
86 glVertex3f(b
/2,-h
/2,0.0f
);
87 glTexCoord2f(1.0f
,1.0f
);
88 glVertex3f(b
/2,h
/2,0.0f
);
89 glTexCoord2f(0.0f
,1.0f
);
90 glVertex3f(-b
/2,h
/2,0.0f
);
94 void k_drawrect1(GLfloat b
,GLfloat h
,GLfloat shifta
,GLfloat shiftb
)
97 glTexCoord2f(0.0f
+shifta
,0.0f
+shiftb
);
98 glVertex3f(-b
/2,-h
/2,0.0f
);
99 glTexCoord2f(1.5f
+shifta
,0.0f
+shiftb
);
100 glVertex3f(b
/2,-h
/2,0.0f
);
101 glTexCoord2f(1.5f
+shifta
,1.5f
+shiftb
);
102 glVertex3f(b
/2,h
/2,0.0f
);
103 glTexCoord2f(0.0f
+shifta
,1.5f
+shiftb
);
104 glVertex3f(-b
/2,h
/2,0.0f
);
108 bool k_DrawGLScene(GLfloat globtime
)
110 if (init
) {k_InitGL();init
=false;}
113 glClear(GL_COLOR_BUFFER_BIT
);
114 k_timer
=-1.0f
+(k_time
)/5000.0f
;
116 glBlendFunc(GL_SRC_ALPHA
,GL_ONE_MINUS_SRC_ALPHA
);
119 glTranslatef(0,0,-5.0f
);
122 //glColor4f(1,1,1,.15+.05*sin(k_timer/13.0f));
123 glColor4f(1,1,1,.25+.25*sin(k_timer
/13.0f
));
124 glRotatef(20*sin(k_timer
*2.0),1,0,0);
125 glRotatef(90*sin(k_timer
),0,0,1);
126 k_drawrect1(8.5,8.5,k_timer
/10.0f
,.25f
-k_timer
/5.0f
);
131 glRotatef(k_timer
*10.0,0,0,1);
132 glTranslatef(0,0,2.0f
*sin(k_timer
/1.0f
));
133 //glColor4f(1,1,1,.1+.1*cos(k_timer/9.0f));
134 glColor4f(1,1,1,.3+.3*cos(k_timer
/9.0f
));
135 k_drawrect1(10,10,.5f
-k_timer
/7.5f
,.75f
+k_timer
/2.5f
);
140 glBlendFunc(GL_ZERO
,GL_ONE_MINUS_SRC_COLOR
);
141 //glColor4f(.75,.75,.75,.5);
143 glTranslatef(0,0,2.0f
*sin(k_timer
/1.0f
));
144 glRotatef(k_timer
*20.0,0,0,1);
145 glTranslatef(0,0,1+2.0f
*sin(k_timer
/2.0f
)*sin(k_timer
/1.0f
));
146 k_drawrect1(10,10,.35f
-k_timer
/10.0f
,.1f
+k_timer
/25.0f
);
149 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
151 /////////////////////////////////////////////////////////////////////////////////
152 /////////////////////////////////////////////////////////////////////////////////
153 /////////////////////////////////////////////////////////////////////////////////
154 /////////////////////////////////////////////////////////////////////////////////
155 /////////////////////////////////////////////////////////////////////////////////
156 /////////////////////////////////////////////////////////////////////////////////
158 if (k_timer
<2.501f
) glTranslatef(0,0,-7.0f
+3.0f
*sin(k_timer
*3.1415f
*.5f
/2.5f
));
159 else glTranslatef(0,0,-4.0f
);
167 glColor4f(k_timer
,k_timer
,k_timer
,1);
168 glBlendFunc(GL_ZERO
,GL_ONE_MINUS_SRC_COLOR
);
171 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
172 glColor4f(1,1,1,k_timer
);
179 glColor4f(1.0f
-10.0f
*(k_timer
-1.0f
),1.0f
-10.0f
*(k_timer
-1.0f
),1.0f
-10.0f
*(k_timer
-1.0f
),1);
180 glBlendFunc(GL_ZERO
,GL_ONE_MINUS_SRC_COLOR
);
183 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
184 glColor4f(1,1,1,20.0f
*(k_timer
-1.0f
));
185 glTranslatef(0,0,15000.0f
*(k_timer
-1.0f
)*(k_timer
-1.0f
)*(k_timer
-1.0f
)*(k_timer
-1.0f
));
190 GLfloat j_tras
=(1.0f
+sin((-k_timer
+1.1f
)*.5*3.1415f
/1.4f
));
191 glTranslatef(0,0,1.5*j_tras
);
192 glColor4f(1,1,1,j_tras
);
202 glColor4f(1,1,1,1.0f
-10.0f
*(k_timer
-1.0f
));
210 GLfloat j_tras
=-sin((-k_timer
+1.1f
)*.5*3.1415f
/1.4f
);
212 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
213 glColor4f(1,1,1,j_tras
);
219 glColor4f(2.0f
*(k_timer
-2.5f
),2.0f
*(k_timer
-2.5f
),2.0f
*(k_timer
-2.5f
),1);
220 glBlendFunc(GL_ZERO
,GL_ONE_MINUS_SRC_COLOR
);
223 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
233 glBlendFunc(GL_ZERO
, GL_ONE_MINUS_SRC_ALPHA
);
234 glDisable(GL_TEXTURE_2D
);
235 glColor4f(1,1,1,-k_timer
);
237 glTranslatef(0,0,-1.0f
);
239 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
240 glEnable(GL_TEXTURE_2D
);
246 glTranslatef(0,0,-1.0);
247 // if (k_timer<2.501f) glTranslatef(0,0,-7.0f+3.0f*sin(k_timer*3.1415f*.5f/2.5f));
248 // else glTranslatef(0,0,-4.0f);
250 glBlendFunc(GL_ZERO
, GL_ONE_MINUS_SRC_COLOR
);
252 k_drawrect(1.85,1.25);
253 //k_drawrect(4.8,2.1);
255 glBlendFunc(GL_SRC_ALPHA
, GL_ONE
);
260 glTranslatef(.03,-.25,-1.0f
);
262 if (k_timer
-2.5f
<.75f
) glColor4f(1,1,1,k_timer
-2.5f
);
263 else glColor4f(1,1,1,.75f
);
265 k_drawrect(1,.03125);
270 glBlendFunc(GL_ZERO
, GL_ONE_MINUS_SRC_ALPHA
);
271 glDisable(GL_TEXTURE_2D
);
272 glColor4f(1,1,1,(k_timer
-4.0f
)/3.25f
);
274 glTranslatef(0,0,-1.0f
);
276 glBlendFunc(GL_SRC_ALPHA
,GL_ONE
);
277 glEnable(GL_TEXTURE_2D
);
281 //*************** FINISH