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 <Scenery/texload.h>
47 static GLuint splash_texid;
48 static GLubyte *splash_texbuf;
51 // Initialize the splash screen
52 void fgSplashInit ( void ) {
54 char tpath[256], fg_tpath[256];
59 fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n");
61 xglGenTextures(1, &splash_texid);
62 xglBindTexture(GL_TEXTURE_2D, splash_texid);
63 #elif GL_EXT_texture_object
64 xglGenTexturesEXT(1, &splash_texid);
65 xglBindTextureEXT(GL_TEXTURE_2D, splash_texid);
70 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
71 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
72 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
73 xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
75 // load in the texture data
77 strcat(tpath, o->fg_root);
78 strcat(tpath, "/Textures/");
79 strcat(tpath, "Splash2.rgb");
81 if ( (splash_texbuf = read_rgb_texture(tpath, &width, &height)) == NULL ) {
83 strcpy(fg_tpath, tpath);
84 strcat(fg_tpath, ".gz");
85 if ( (splash_texbuf = read_rgb_texture(fg_tpath, &width, &height))
87 fgPrintf( FG_GENERAL, FG_EXIT,
88 "Error in loading splash screen texture %s\n", tpath );
92 xglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
93 GL_UNSIGNED_BYTE, (GLvoid *)(splash_texbuf) );
97 // Update the splash screen with progress specified from 0.0 to 1.0
98 void fgSplashUpdate ( double progress ) {
99 int xmin, ymin, xmax, ymax;
103 xmin = (640 - xsize) / 2;
106 ymin = (480 - ysize) / 2;
109 xglMatrixMode(GL_PROJECTION);
112 gluOrtho2D(0, 640, 0, 480);
113 xglMatrixMode(GL_MODELVIEW);
117 xglDisable(GL_DEPTH_TEST);
118 xglDisable(GL_LIGHTING);
119 xglEnable(GL_TEXTURE_2D);
120 #ifdef GL_VERSION_1_1
121 xglBindTexture(GL_TEXTURE_2D, splash_texid);
122 #elif GL_EXT_texture_object
123 xglBindTextureEXT(GL_TEXTURE_2D, splash_texid);
127 xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
129 xglBegin(GL_POLYGON);
130 xglTexCoord2f(0.0, 0.0); glVertex2f(xmin, ymin);
131 xglTexCoord2f(1.0, 0.0); glVertex2f(xmax, ymin);
132 xglTexCoord2f(1.0, 1.0); glVertex2f(xmax, ymax);
133 xglTexCoord2f(0.0, 1.0); glVertex2f(xmin, ymax);
138 xglEnable(GL_DEPTH_TEST);
139 xglEnable(GL_LIGHTING);
140 xglDisable(GL_TEXTURE_2D);
142 xglMatrixMode(GL_PROJECTION);
144 xglMatrixMode(GL_MODELVIEW);
150 // Revision 1.1 1998/07/06 02:42:36 curt