/** * @brief Custom widget render function for the slot widget. */ static void shipyard_renderSlots( double bx, double by, double bw, double bh, void *data ) { (void) data; double x, y, w; Ship *ship; /* Make sure a valid ship is selected. */ ship = shipyard_selected; if (ship == NULL) return; y = by + bh; /* Draw rotated text. */ y -= 10; gl_print( &gl_smallFont, bx, y, &cBlack, "Slots:" ); x = bx + 10.; w = bw - 10.; /* Weapon slots. */ y -= 20; shipyard_renderSlotsRow( x, y, w, "W", ship->outfit_weapon, ship->outfit_nweapon ); /* Utility slots. */ y -= 20; shipyard_renderSlotsRow( x, y, w, "U", ship->outfit_utility, ship->outfit_nutility ); /* Structure slots. */ y -= 20; shipyard_renderSlotsRow( x, y, w, "S", ship->outfit_structure, ship->outfit_nstructure ); }
/** * @brief Draw intro text onto the screen. * * @brief sb_list List of text lines. * @brief offset For smooth scrolling. * @brief line_height V-space of the font (plus leading). * @return Whether to stop. 1 if no text was rendered, 0 otherwise. */ static int intro_draw_text( scroll_buf_t *sb_list, double offset, double line_height) { double x, y; /* render position. */ scroll_buf_t *list_iter; /* iterator through sb_list. */ register int stop = 1; if (has_side_gfx) { /* leave some space for graphics if they exist. */ x = 400.0; } else { x = 100.0; } list_iter = sb_list; y = SCREEN_H + offset - line_height; do { if (NULL != list_iter->text) { stop = 0; gl_print( &intro_font, x, y, &cConsole, list_iter->text ); } y -= line_height; list_iter = list_iter->next; } while (list_iter != sb_list); return stop; }
/** * @brief Renders the legend. */ static void weapons_renderLegend( double bx, double by, double bw, double bh, void* data ) { (void) data; (void) bw; (void) bh; double y; y = by+bh-20; gl_print( &gl_defFont, bx, y, &cBlack, "Legend" ); y -= 20.; toolkit_drawRect( bx, y, 10, 10, &cFontYellow, NULL ); gl_print( &gl_smallFont, bx+20, y, &cBlack, "Secondary Weapon (Right click toggles)" ); y -= 15.; toolkit_drawRect( bx, y, 10, 10, &cFontRed, NULL ); gl_print( &gl_smallFont, bx+20, y, &cBlack, "Primary Weapon (Left click toggles)" ); }
/** * @brief Displays FPS on the screen. * * @param[in] dt Current delta tick. */ static void display_fps( const double dt ) { double x,y; fps_dt += dt; fps_cur += 1.; if (fps_dt > 1.) { /* recalculate every second */ fps = fps_cur / fps_dt; fps_dt = fps_cur = 0.; } x = 15.; y = (double)(gl_screen.h-15-gl_defFont.h); if (conf.fps_show) { gl_print( NULL, x, y, NULL, "%3.2f", fps ); y -= gl_defFont.h + 5.; } if (dt_mod != 1.) gl_print( NULL, x, y, NULL, "%3.1fx", dt_mod); }
/** * @brief Renders a row of ship slots. */ static void shipyard_renderSlotsRow( double bx, double by, double bw, char *str, ShipOutfitSlot *s, int n ) { (void) bw; int i; double x; const glColour *c; x = bx; /* Print text. */ gl_print( &gl_smallFont, bx, by, &cBlack, str ); /* Draw squares. */ for (i=0; i<n; i++) { c = outfit_slotSizeColour( &s[i].slot ); if (c == NULL) c = &cBlack; x += 15.; toolkit_drawRect( x, by, 10, 10, c, NULL ); } }
/** render the scene */ void draw_scene() { static int cn = 0; static int part = 0; glClear(GL_COLOR_BUFFER_BIT); SDL_Delay(40); glMatrixMode(GL_PROJECTION); glLoadIdentity(); /* here take the bounding box of the whole circuit */ vcg::Point3f bmin = race.circuit->bbox.min; vcg::Point3f bmax = race.circuit->bbox.max; float sidex, sidez; sidex = bmax[0] - bmin[0]; sidez = bmax[2] - bmin[2]; cli.UpdatePlayers(); if (!cli.players.empty()) glOrtho(-6, 6, -6, 6, 0.0, 10.0); else glOrtho(-sidex*vieww, sidex*vieww, -sidez*vieww, sidez*vieww, 0.0, 400); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if (!cli.players.empty()) { vcg::Point4f pos = (*cli.players.begin()).car.frame.O(); gluLookAt(pos[0], 6.0, pos[2], pos[0], pos[1], pos[2], 0, 0, -1); } else { gluLookAt(obs[0], obs[1], obs[2], obs[0], obs[1] - 400, obs[2], 0, 0, -1); } // draw bounding box of the terrain glColor3f(0.1, 0.2, 0.4); glBegin(GL_QUADS); glVertex3f(bmin[0], bmin[1], bmin[2]); glVertex3f(bmax[0], bmin[1], bmin[2]); glVertex3f(bmax[0], bmin[1], bmax[2]); glVertex3f(bmin[0], bmin[1], bmax[2]); glEnd(); glPushMatrix(); glScalef(bmax[0] - bmin[0], bmax[1] - bmin[1], bmax[2] - bmin[2]); draw_axis(); glPopMatrix(); // draw circuit Street::TilesIterator ti; int i; glColor3f(1.0, 0.0, 0.0); glPolygonMode(GL_FRONT, GL_LINE); glBegin(GL_QUAD_STRIP); for (i = 0, ti = race.circuit->street.path.begin(); ti != race.circuit->street.path.end(); ++ti, ++i) { vcg::Point3f p0, p1; p0 = (*ti)[0].P(); p1 = (*ti)[1].P(); glVertex3f(p0[0], p0[1] + 0.1, p0[2]); glVertex3f(p1[0], p1[1] + 0.1, p1[2]); } glEnd(); // draw tunnels Street::TunnelsIterator tni; glColor3f(1.0, 1.0, 0.0); glPolygonMode(GL_FRONT, GL_FILL); for (i = 0, tni = race.circuit->street.tunnels.begin(); tni != race.circuit->street.tunnels.end(); ++tni, ++i) { glBegin(GL_QUAD_STRIP); for (i = 0, ti = (*tni).path.begin(); ti != (*tni).path.end(); ++ti, ++i) { vcg::Point3f p0, p1; p0 = (*ti)[0].P(); p1 = (*ti)[1].P(); glVertex3f(p0[0], p0[1] + 0.2, p0[2]); glVertex3f(p1[0], p1[1] + 0.2, p1[2]); } glEnd(); } // draw buildings Circuit::BuildingsIterator bi; glColor3f(1.0, 1.0, 1.0); glPolygonMode(GL_FRONT, GL_FILL); for (bi = race.circuit->buildings.begin(); bi != race.circuit->buildings.end(); ++bi) { glBegin(GL_POLYGON); for (i = 0; i < (*bi).footprint.size(); ++i) glVertex3f((*bi).footprint[i].P()[0], (*bi).footprint[i].P()[1], (*bi).footprint[i].P()[2]); glEnd(); } // draw trees Circuit::TreesIterator tsi; glColor3f(10.0, 1.0, 0.0); glBegin(GL_POINTS); for (tsi = race.circuit->trees.begin(); tsi != race.circuit->trees.end(); ++tsi) glVertex3f((*tsi).pos[0], (*tsi).pos[1], (*tsi).pos[2]); glEnd(); // draw players Race::PlayersIterator pi; int st = clock(); /* updte the state of the players as received by the server */ for (pi = cli.players.begin(); pi != cli.players.end(); ++pi) { glPushMatrix(); /* apply transformation coded in the frame */ Frame f = ((*pi).car.frame); glMultMatrixf(&f[0][0]); glPushMatrix(); glColor3f(1.0, 1.0, 1.0); glRotatef(90, 0, 1, 0); glutSolidTeapot(3.0); // draw the teapot (300 meters in size! ) glColor3f(0, 1, 0); glBegin(GL_LINES); glVertex3f(0.0, 1.0, 1.0); glVertex3f(0.0, 1.0, -1.0); glEnd(); glColor3f(0, 0, 1); glTranslatef(0.0, 0.0, (*pi).car.front_wheel_pos); glRotatef((*pi).car.steering_angle * 180.0 / M_PI, 0, 1, 0); glBegin(GL_LINES); glVertex3f(0.0, 1.0, 0.4); glVertex3f(0.0, 1.0, -0.4); glEnd(); glPopMatrix(); glColor3f(1.0, 0.0, 0.0); gl_print(100.0, 100.0, ((*pi).ip_address.toString()).toAscii().data()); // write the IP address of the client glPopMatrix(); } glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); /* print the commands */ glColor3f(1.0, 1.0, 0.0); gl_print(-1, 0.8, "accel: w"); gl_print(-1, 0.7, "slow: s"); gl_print(-1, 0.6, "left: a"); gl_print(-1, 0.5, "right: d"); gl_print(-1, 0.4, "brake: x"); gl_print(-1, 0.3, "reset: p"); if (sendSS) { cli.SendScreenshot(); sendSS = false; } cli.DrawScreenshots(std::string()); SDL_GL_SwapBuffers(); cn++; if (clock() - part > 1000) { printf("VIEW fps %d\n", cn); part = clock(); cn = 0; } }
/** * @brief Renders the custom map widget. * * @param bx Base X position to render at. * @param by Base Y position to render at. * @param w Width of the widget. * @param h Height of the widget. */ static void map_render( double bx, double by, double w, double h, void *data ) { (void) data; int i,j, n,m; double x,y,r, tx,ty, fuel; StarSystem *sys, *jsys, *hsys, *lsys; glColour *col, c; GLfloat vertex[8*(2+4)]; int sw, sh; /* Parameters. */ r = round(CLAMP(5., 15., 6.*map_zoom)); x = round((bx - map_xpos + w/2) * 1.); y = round((by - map_ypos + h/2) * 1.); /* background */ gl_renderRect( bx, by, w, h, &cBlack ); /* * First pass renders everything almost (except names and markers). */ for (i=0; i<systems_nstack; i++) { sys = system_getIndex( i ); /* check to make sure system is known or adjacent to known (or marked) */ if (!sys_isFlag(sys, SYSTEM_MARKED | SYSTEM_CMARKED) && !space_sysReachable(sys)) continue; tx = x + sys->pos.x*map_zoom; ty = y + sys->pos.y*map_zoom; /* draws the disk representing the faction */ if (sys_isKnown(sys) && (sys->faction != -1)) { sw = gl_faction_disk->sw; sh = gl_faction_disk->sw; col = faction_colour(sys->faction); c.r = col->r; c.g = col->g; c.b = col->b; c.a = 0.7; gl_blitTexture( gl_faction_disk, tx - sw/2, ty - sh/2, sw, sh, 0., 0., gl_faction_disk->srw, gl_faction_disk->srw, &c ); } /* Draw the system. */ if (!sys_isKnown(sys) || (sys->nfleets==0)) col = &cInert; else if (sys->security >= 1.) col = &cGreen; else if (sys->security >= 0.6) col = &cOrange; else if (sys->security >= 0.3) col = &cRed; else col = &cDarkRed; gl_drawCircleInRect( tx, ty, r, bx, by, w, h, col, 0 ); /* If system is known fill it. */ if (sys_isKnown(sys) && (sys->nplanets > 0)) { /* Planet colours */ if (!sys_isKnown(sys)) col = &cInert; else if (sys->nplanets==0) col = &cInert; else col = faction_getColour( sys->faction); /* Radius slightly shorter. */ gl_drawCircleInRect( tx, ty, 0.5*r, bx, by, w, h, col, 1 ); } if (!sys_isKnown(sys)) continue; /* we don't draw hyperspace lines */ /* draw the hyperspace paths */ glShadeModel(GL_SMOOTH); col = &cDarkBlue; /* first we draw all of the paths. */ for (j=0; j<sys->njumps; j++) { jsys = system_getIndex( sys->jumps[j] ); if (hyperspace_target != -1) hsys = system_getIndex( cur_system->jumps[hyperspace_target] ); /* Draw the lines. */ vertex[0] = x + sys->pos.x * map_zoom; vertex[1] = y + sys->pos.y * map_zoom; vertex[2] = vertex[0] + (jsys->pos.x - sys->pos.x)/2. * map_zoom; vertex[3] = vertex[1] + (jsys->pos.y - sys->pos.y)/2. * map_zoom; vertex[4] = x + jsys->pos.x * map_zoom; vertex[5] = y + jsys->pos.y * map_zoom; vertex[6] = col->r; vertex[7] = col->g; vertex[8] = col->b; vertex[9] = 0.; vertex[10] = col->r; vertex[11] = col->g; vertex[12] = col->b; vertex[13] = col->a; vertex[14] = col->r; vertex[15] = col->g; vertex[16] = col->b; vertex[17] = 0.; gl_vboSubData( map_vbo, 0, sizeof(GLfloat) * 3*(2+4), vertex ); gl_vboActivateOffset( map_vbo, GL_VERTEX_ARRAY, 0, 2, GL_FLOAT, 0 ); gl_vboActivateOffset( map_vbo, GL_COLOR_ARRAY, sizeof(GLfloat) * 2*3, 4, GL_FLOAT, 0 ); glDrawArrays( GL_LINE_STRIP, 0, 3 ); gl_vboDeactivate(); } glShadeModel( GL_FLAT ); } /* Now we'll draw over the lines with the new pathways. */ if (map_path != NULL) { lsys = cur_system; glShadeModel(GL_SMOOTH); col = &cGreen; fuel = player->fuel; for (j=0; j<map_npath; j++) { jsys = map_path[j]; if (fuel == player->fuel) col = &cGreen; else if (fuel < 100.) col = &cRed; else col = &cYellow; fuel -= 100; /* Draw the lines. */ vertex[0] = x + lsys->pos.x * map_zoom; vertex[1] = y + lsys->pos.y * map_zoom; vertex[2] = vertex[0] + (jsys->pos.x - lsys->pos.x)/2. * map_zoom; vertex[3] = vertex[1] + (jsys->pos.y - lsys->pos.y)/2. * map_zoom; vertex[4] = x + jsys->pos.x * map_zoom; vertex[5] = y + jsys->pos.y * map_zoom; vertex[6] = col->r; vertex[7] = col->g; vertex[8] = col->b; vertex[9] = 0.; vertex[10] = col->r; vertex[11] = col->g; vertex[12] = col->b; vertex[13] = col->a; vertex[14] = col->r; vertex[15] = col->g; vertex[16] = col->b; vertex[17] = 0.; gl_vboSubData( map_vbo, 0, sizeof(GLfloat) * 3*(2+4), vertex ); gl_vboActivateOffset( map_vbo, GL_VERTEX_ARRAY, 0, 2, GL_FLOAT, 0 ); gl_vboActivateOffset( map_vbo, GL_COLOR_ARRAY, sizeof(GLfloat) * 2*3, 4, GL_FLOAT, 0 ); glDrawArrays( GL_LINE_STRIP, 0, 3 ); gl_vboDeactivate(); lsys = jsys; } glShadeModel( GL_FLAT ); } /* * Second pass - System names */ for (i=0; i<systems_nstack; i++) { sys = system_getIndex( i ); /* Skip system. */ if (!sys_isKnown(sys) || (map_zoom <= 0.5 )) continue; tx = x + (sys->pos.x+11.) * map_zoom; ty = y + (sys->pos.y-5.) * map_zoom; gl_print( &gl_smallFont, tx + SCREEN_W/2., ty + SCREEN_H/2., &cWhite, sys->name ); } /* * Third pass - system markers */ for (i=0; i<systems_nstack; i++) { sys = system_getIndex( i ); /* We only care about marked now. */ if (!sys_isFlag(sys, SYSTEM_MARKED | SYSTEM_CMARKED)) continue; /* Get the position. */ tx = x + sys->pos.x*map_zoom; ty = y + sys->pos.y*map_zoom; /* Count markers. */ n = (sys_isFlag(sys, SYSTEM_CMARKED)) ? 1 : 0; n += sys->markers_misc; n += sys->markers_cargo; n += sys->markers_rush; /* Draw the markers. */ j = 0; if (sys_isFlag(sys, SYSTEM_CMARKED)) { map_drawMarker( tx, ty, r, n, j, 0 ); j++; } for (m=0; m<sys->markers_misc; m++) { map_drawMarker( tx, ty, r, n, j, 1 ); j++; } for (m=0; m<sys->markers_rush; m++) { map_drawMarker( tx, ty, r, n, j, 2 ); j++; } for (m=0; m<sys->markers_cargo; m++) { map_drawMarker( tx, ty, r, n, j, 3 ); j++; } } /* Selected planet. */ if (map_selected != -1) { sys = system_getIndex( map_selected ); gl_drawCircleInRect( x + sys->pos.x * map_zoom, y + sys->pos.y * map_zoom, 1.5*r, bx, by, w, h, &cRed, 0 ); } /* Current planet. */ gl_drawCircleInRect( x + cur_system->pos.x * map_zoom, y + cur_system->pos.y * map_zoom, 1.5*r, bx, by, w, h, &cRadar_tPlanet, 0 ); }
/** * @brief Displays the introduction sequence. * * @brief text Path of text file to use. * @brief mus Type of music to use (run through music.lua). * @return 0 on success. */ int intro_display( const char *text, const char *mus ) { int i, max; unsigned int tcur, tlast; double dt; double x, y, vel; double offset; double density; SDL_Event event; /* Load the introduction. */ if (intro_load(text) < 0) return -1; /* Calculate velocity. */ density = ((double)intro_length / (double)intro_nlines); /* char / line */ density /= (double)intro_font.h; /* char / pixel */ vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */ /* Change music to intro music. */ if (mus != NULL) music_choose(mus); /* We need to clear key repeat to avoid infinite loops. */ toolkit_clearKey(); /* Prepare for intro loop. */ x = 100.; y = 0.; tlast = SDL_GetTicks(); offset = 0.; max = intro_nlines + SCREEN_H / ((intro_font.h + 5.)); while (1) { /* Get delta tick in seconds. */ tcur = SDL_GetTicks(); dt = (double)(tcur - tlast) / 1000.; tlast = tcur; /* Handle events. */ while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: /* Escape skips directly. */ if (event.key.keysym.sym == SDLK_ESCAPE) offset = max * (intro_font.h + 5.); /* Only Handle space from here down. */ else if (!nstd_isspace(event.key.keysym.sym)) break; /* Purpose fallthrough. */ case SDL_JOYBUTTONDOWN: offset += 250.; default: break; } } /* Increment position. */ offset += vel * dt; /* Clear stuff. */ glClear(GL_COLOR_BUFFER_BIT); /* Draw the text. */ i = (int)(offset / (intro_font.h + 5.)); if (i > max) /* Out of lines. */ break; y = offset - (i+1) * (intro_font.h + 5.); while (i >= 0) { /* Skip in line isn't valid. */ if (i >= intro_nlines) { i--; y += intro_font.h + 5.; continue; } gl_print( &intro_font, x, y, &cConsole, intro_lines[i] ); /* Increment line and position. */ i--; y += intro_font.h + 5.; } /* Only thing we actually care about updating is music. */ music_update(); /* Display stuff. */ SDL_GL_SwapBuffers(); SDL_Delay(10); /* No need to burn CPU. */ } /* Stop music, normal music will start shortly after. */ music_stop(); /* Clean up after the introduction. */ intro_cleanup(); return 0; }
/** * @brief Renders the custom map widget. * * @param bx Base X position to render at. * @param by Base Y position to render at. * @param w Width of the widget. * @param h Height of the widget. */ static void map_render( double bx, double by, double w, double h ) { int i,j, n,m; double x,y,r, tx,ty; StarSystem *sys, *jsys, *hsys; glColour* col; r = 5.; x = (bx - map_xpos + w/2) * 1.; y = (by - map_ypos + h/2) * 1.; /* background */ COLOUR(cBlack); glBegin(GL_QUADS); glVertex2d( bx, by ); glVertex2d( bx, by+h ); glVertex2d( bx+w, by+h ); glVertex2d( bx+w, by ); glEnd(); /* GL_QUADS */ /* render the star systems */ for (i=0; i<systems_nstack; i++) { sys = system_getIndex( i ); /* check to make sure system is known or adjacent to known (or marked) */ if (!sys_isFlag(sys, SYSTEM_MARKED | SYSTEM_CMARKED) && !space_sysReachable(sys)) continue; /* system colours */ if (sys==cur_system) col = &cRadar_tPlanet; else if (!sys_isKnown(sys) || (sys->nplanets==0)) col = &cInert; else col = faction_getColour( sys->faction); COLOUR(*col); /* draw the system */ tx = x + sys->pos.x*map_zoom; ty = y + sys->pos.y*map_zoom; gl_drawCircleInRect( tx, ty, r, bx, by, w, h ); /* draw the system name */ if (sys_isKnown(sys) && (map_zoom > 0.5 )) { tx = x + 7. + sys->pos.x * map_zoom; ty = y - 5. + sys->pos.y * map_zoom; gl_print( &gl_smallFont, tx + SCREEN_W/2., ty + SCREEN_H/2., &cWhite, sys->name ); } if (!sys_isKnown(sys)) continue; /* we don't draw hyperspace lines */ /* draw the hyperspace paths */ glShadeModel(GL_SMOOTH); /* cheaply use transparency instead of actually calculating * from where to where the line must go :) */ for (j=0; j<sys->njumps; j++) { jsys = system_getIndex( sys->jumps[j] ); if (hyperspace_target != -1) hsys = system_getIndex( cur_system->jumps[hyperspace_target] ); n = map_inPath(jsys); m = map_inPath(sys); /* set the colours */ /* is the route the current one? */ if ((hyperspace_target != -1) && ( ((cur_system==sys) && (j==hyperspace_target)) || ((cur_system==jsys) && (sys==hsys )))) { if (player->fuel < HYPERSPACE_FUEL) col = &cRed; else col = &cGreen; } /* is the route part of the path? */ else if ((n > 0) && (m > 0)) { if ((n == 2) || (m == 2)) /* out of fuel */ col = &cRed; else col = &cYellow; } else col = &cDarkBlue; glBegin(GL_LINE_STRIP); ACOLOUR(*col,0.); tx = x + sys->pos.x * map_zoom; ty = y + sys->pos.y * map_zoom; glVertex2d( tx, ty ); COLOUR(*col); tx += (jsys->pos.x - sys->pos.x)/2. * map_zoom; ty += (jsys->pos.y - sys->pos.y)/2. * map_zoom; glVertex2d( tx, ty ); ACOLOUR(*col,0.); tx = x + jsys->pos.x * map_zoom; ty = y + jsys->pos.y * map_zoom; glVertex2d( tx, ty ); glEnd(); /* GL_LINE_STRIP */ } glShadeModel(GL_FLAT); } /* Second pass to put markers. */ for (i=0; i<systems_nstack; i++) { sys = system_getIndex( i ); /* We only care about marked now. */ if (!sys_isFlag(sys, SYSTEM_MARKED | SYSTEM_CMARKED)) continue; /* Get the position. */ tx = x + sys->pos.x*map_zoom; ty = y + sys->pos.y*map_zoom; /* Count markers. */ n = (sys_isFlag(sys, SYSTEM_CMARKED)) ? 1 : 0; n += sys->markers_misc; n += sys->markers_cargo; n += sys->markers_rush; /* Draw the markers. */ j = 0; if (sys_isFlag(sys, SYSTEM_CMARKED)) { map_drawMarker( tx, ty, r, n, j, 0 ); j++; } for (m=0; m<sys->markers_misc; m++) { map_drawMarker( tx, ty, r, n, j, 1 ); j++; } for (m=0; m<sys->markers_rush; m++) { map_drawMarker( tx, ty, r, n, j, 2 ); j++; } for (m=0; m<sys->markers_cargo; m++) { map_drawMarker( tx, ty, r, n, j, 3 ); j++; } } /* selected planet */ if (map_selected != -1) { sys = system_getIndex( map_selected ); COLOUR(cRed); gl_drawCircleInRect( x + sys->pos.x * map_zoom, y + sys->pos.y * map_zoom, r+3., bx, by, w, h ); } }
GLvoid draw_tile(tile* t, u_int d, u_int draw, GLfloat alpha) { u_int i; //printf("draw_tile(%d)\n", (u_int) t); if (t == NULL) return; if (t->flags & TILE_DRAWN) return; t->flags |= TILE_DRAWN; glPushMatrix(); glTranslatef((GLfloat) t->coord[0], 0, (GLfloat) t->coord[1]); if (draw & DRAW_WALL) draw_tile_wall(t); if ((t->flags & TILE_HAS_PRISM) && (draw & DRAW_PRISM)) draw_tile_prism(t->prism_dir, t->prism_color); if (draw & DRAW_INFO) { glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fvone); glMaterialfv(GL_FRONT, GL_EMISSION, fvone); gl_print(0.0f, 0.0f, 0.0f, tile_label(t)); } if ((t->flags & TILE_HAS_MARK) && (draw & DRAW_MARK)) draw_tile_mark(t->mark_type, t->mark_color, alpha); if (draw & DRAW_TILE) { tile_diffuse[3] = alpha; tile_emit[3] = alpha; glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, tile_diffuse); glMaterialfv(GL_FRONT, GL_EMISSION, tile_emit); glPushMatrix(); //glTranslatef(0.0f, 0.025f, 0.0f); // glScalef(1.0f, 0.05f, 1.0f); //glutSolidCube(1.0f); glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_TILE]); // glActiveTextureARB( GL_TEXTURE1_ARB ); // glClientActiveTextureARB( GL_TEXTURE1_ARB ); // glEnable( GL_TEXTURE_2D ); //Set up the blending of the 2 textures /*glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT); glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT,GL_INTERPOLATE_EXT); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT,GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_EXT,GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT,GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT,GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE2_RGB_EXT,GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND2_RGB_EXT,GL_SRC_ALPHA);*/ //Texture 0 on TU 1 //glBindTexture( GL_TEXTURE_2D, textures[TEXTURE_MARK_MOON_RED]); //Switch off the TU 1 // glDisable( GL_TEXTURE_2D ); // glActiveTextureARB( GL_TEXTURE0_ARB ); // glClientActiveTextureARB( GL_TEXTURE0_ARB ); glBegin(GL_QUADS); glTexCoord2d(0.0, 0.0); glVertex3f(-0.5, 0.0, -0.5); glTexCoord2d(0.0, 1.0); glVertex3f(-0.5, 0.0, 0.5); glTexCoord2d(1.0, 1.0); glVertex3f( 0.5, 0.0, 0.5); glTexCoord2d(1.0, 0.0); glVertex3f( 0.5, 0.0, -0.5); glEnd(); glPopMatrix(); /* glLineWidth(2.0f); glPushMatrix(); glTranslatef(0, 0.06, 0); glScalef(0.5f, 1, 0.5f); glBegin(GL_LINE_LOOP); glVertex3f(-1, 0, -1); glVertex3f(1, 0, -1); glVertex3f(1, 0, 1); glVertex3f(-1, 0, 1); glEnd(); glPopMatrix(); */ } glPopMatrix(); for (i = 0; i < DIRS; i++) draw_tile(t->tile_p[i], i, draw, alpha); }