1 // splash.cxx -- draws the initial splash screen
3 // Written by Curtis Olson, started July 1998. (With a little looking
4 // at Freidemann's panel code.) :-)
6 // Copyright (C) 1997 Michele F. America - nomimarketing@mail.telepac.pt
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 // (Log is kept at end of this file)
39 #include <Aircraft/aircraft.h>
40 #include <Debug/fg_debug.h>
41 #include <Main/options.hxx>
42 #include <Objects/texload.h>
47 static GLuint splash_texid;
48 static GLubyte *splash_texbuf;
51 // Initialize the splash screen
52 void fgSplashInit ( void ) {
53 string tpath, fg_tpath;
56 fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n");
58 xglGenTextures(1, &splash_texid);
59 xglBindTexture(GL_TEXTURE_2D, splash_texid);
60 #elif GL_EXT_texture_object
61 xglGenTexturesEXT(1, &splash_texid);
62 xglBindTextureEXT(GL_TEXTURE_2D, splash_texid);
67 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
68 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
69 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
70 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
72 // load in the texture data
73 tpath = current_options.get_fg_root() + "/Textures/Splash2.rgb";
76 read_rgb_texture(tpath.c_str(), &width, &height)) == NULL )
79 fg_tpath = tpath + ".gz";
81 read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL )
83 fgPrintf( FG_GENERAL, FG_EXIT,
84 "Error in loading splash screen texture %s\n",
89 xglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
90 GL_UNSIGNED_BYTE, (GLvoid *)(splash_texbuf) );
94 // Update the splash screen with progress specified from 0.0 to 1.0
95 void fgSplashUpdate ( double progress ) {
96 int xmin, ymin, xmax, ymax;
100 xmin = (640 - xsize) / 2;
103 ymin = (480 - ysize) / 2;
106 // first clear the screen;
107 xglClearColor(0.0, 0.0, 0.0, 1.0);
108 xglClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
111 xglMatrixMode(GL_PROJECTION);
114 gluOrtho2D(0, 640, 0, 480);
115 xglMatrixMode(GL_MODELVIEW);
119 xglDisable(GL_DEPTH_TEST);
120 xglDisable(GL_LIGHTING);
121 xglEnable(GL_TEXTURE_2D);
122 #ifdef GL_VERSION_1_1
123 xglBindTexture(GL_TEXTURE_2D, splash_texid);
124 #elif GL_EXT_texture_object
125 xglBindTextureEXT(GL_TEXTURE_2D, splash_texid);
129 xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
131 xglBegin(GL_POLYGON);
132 xglTexCoord2f(0.0, 0.0); glVertex2f(xmin, ymin);
133 xglTexCoord2f(1.0, 0.0); glVertex2f(xmax, ymin);
134 xglTexCoord2f(1.0, 1.0); glVertex2f(xmax, ymax);
135 xglTexCoord2f(0.0, 1.0); glVertex2f(xmin, ymax);
140 xglEnable(GL_DEPTH_TEST);
141 xglEnable(GL_LIGHTING);
142 xglDisable(GL_TEXTURE_2D);
144 xglMatrixMode(GL_PROJECTION);
146 xglMatrixMode(GL_MODELVIEW);
152 // Revision 1.5 1998/09/26 13:17:29 curt
153 // Clear screen to "black" before drawing splash screen.
155 // Revision 1.4 1998/08/27 17:02:08 curt
156 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
157 // - use strings for fg_root and airport_id and added methods to return
159 // - inlined all access methods,
160 // - made the parsing functions private methods,
161 // - deleted some unused functions.
162 // - propogated some of these changes out a bit further.
164 // Revision 1.3 1998/08/25 16:59:10 curt
165 // Directory reshuffling.
167 // Revision 1.2 1998/07/13 21:01:40 curt
168 // Wrote access functions for current fgOPTIONS.
170 // Revision 1.1 1998/07/06 02:42:36 curt