void choose_floor(t_env *e, int start) { if (e->text == 0) { draw_tlfloor(e, start); draw_tlfloor(e, HEIGHT - start); } else { draw_floor(e, start, 4); draw_floor(e, HEIGHT - start, 3); } }
//render screen void render(Level &level, Player &plr) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); plr.cameraTarget = lookat(GLCoord(plr.pos.x, plr.pos.y, plr.pos.z), plr.cameraDirection); gluLookAt(plr.pos.x, plr.pos.y, plr.pos.z, plr.cameraTarget.x, plr.cameraTarget.y, plr.cameraTarget.z, 0, 0, 1); draw_floor(plr.pos); draw_ceiling(plr.pos); Coord colorpos = color(level, plr.pos, plr.cameraTarget - plr.pos); for(int y = -VIEWDISTANCE; y < VIEWDISTANCE; y++) { for(int x = -VIEWDISTANCE; x < VIEWDISTANCE; x++) { Coord curpos = Coord((int)plr.pos.x, (int)plr.pos.y) + Coord(x, y); if(!level.data.contains(curpos)) generate(level.data, curpos, GENDISTANCE); char data = '.'; data = level.data.get(curpos, '.'); if(data == '#') Cube(GLCoord(curpos.x, curpos.y, 0), wallTexture).draw(); else if(data == '%') Cube(GLCoord(curpos.x, curpos.y, 0), highlightTexture).draw(); } } level.srch.render(); if(level.data.get(colorpos, '.') == '%') level.data.add('#', colorpos); SDL_GL_SwapWindow(screen); }
void draw_column(t_raycaster *r, t_map *map, t_img *img, int x) { int line_height; int draw_start; int draw_end; int y; line_height = abs((int)(img->height / r->w_dis)); draw_start = -line_height / 2 + img->height / 2; draw_end = line_height / 2 + img->height / 2; if (draw_start < 0) draw_start = 0; if (draw_end >= img->height) draw_end = img->height - 1; y = draw_start; while (y < draw_end) { r->wall_y = -(((double)(y * 256 - img->height * 128 + line_height * 128)) / line_height) / 256 + 1; color_of_texture(tile_at_index(map, r->map.x, r->map.y), r->wall_x, r->wall_y); put_pixel(img, (t_pix){x, y}); y++; } draw_sky(img, r, (t_pix){x, draw_start}); draw_floor(img, map, r, (t_pix){x, draw_end}); }
void elevator_system_drawer::draw_all_floors(Wt::WPainter& painter, Wt::WRectF const& rc) { auto const num_floors = get_num_floors(); for(elevator_system::floor_t floor = 0; floor < num_floors; ++floor) { draw_floor(painter, floor_rect(floor, rc)); } }
void draw_opener_floor (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { struct opener_floor *o = opener_floor_at_pos (p); if (! o) return; if (o->broken) return; if (o->pressed) draw_floor (bitmap, p, em, vm); else draw_unpressed_opener_floor (bitmap, p, em, vm); }
void display_3d(void) { glMatrixMode(GL_MODELVIEW); /* Update viewer position in modelview matrix */ glLoadIdentity(); set_viewpoint(); glTranslatef(-1,0,0); glColor3f(0.5, 0.5, 0.5); int r = 0; std::for_each(maze->begin(), maze->end(), std::bind2nd(draw_row(), &r)); draw_rat(walker->position(), true); draw_floor(); }
void draw_loose_floor (ALLEGRO_BITMAP *bitmap, struct pos *p, enum em em, enum vm vm) { struct loose_floor *l = loose_floor_at_pos (p); if (! l) return; if (l->action == FALL_LOOSE_FLOOR) return; else { switch (l->state) { case 0: draw_floor (bitmap, p, em, vm); break; case 1: draw_loose_floor_00 (bitmap, p, em, vm); break; case 2: draw_loose_floor_01 (bitmap, p, em, vm); break; } } }
void display() { glEnable(GL_DEPTH_TEST); glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60, 1, 0.1, 100); // glLoadMatrixf(&modelM[0][0]); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0,0,15 , 0,0,0, 0,1,0); glRotatef(x_angle, 0,1,0); glRotatef(y_angle, 1,0,0); glScalef(scale_size, scale_size, scale_size); glBindBuffer(GL_ARRAY_BUFFER, vboHandle); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexVBO); glEnableClientState(GL_VERTEX_ARRAY); // enable the vertex array on the client side //glEnableClientState(GL_COLOR_ARRAY); // enable the color array on the client side // number of coordinates per vertex (4 here), type of the coordinates, // stride between consecutive vertices, and pointers to the first coordinate // glColorPointer(4, GL_FLOAT, sizeof(Vertex), (char*) NULL+ sizeof(float)*4); glVertexPointer(4,GL_FLOAT, sizeof(Vertex), (char*) NULL+ 0); // glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, (char*) NULL+0); //draw_cube(1,c1); //draw_cylinder(1.0f,3.0f,5.0f,12,c2); //draw_sphere(1,12,12,c3); draw_floor(); draw_man(); //draw_square2(modelM,cc); glDisableClientState(GL_VERTEX_ARRAY); //glDisableClientState(GL_COLOR_ARRAY); glutSwapBuffers(); }
void drawx(t_mlx *mlx) { int x; float val; float length; float wall; float deg; x = 0; length = 0; wall = 0; deg = mlx->deg - 30; val = (60 / (float)mlx->w); draw_sky(mlx); draw_floor(mlx); while (x <= mlx->w) { length = line(mlx, 0, deg); wall = mlx->h / length; drawy(mlx, wall, x); deg += val; x++; } }
void draw_skybox(void){ int i; /* stuff min and max grid data into a more convenient form assuming the following grid numbering scheme 5-------6 / | /| / | / | 4 -------7 | | | | | Z 1---|---2 | Y | / |/ |/ 0--X-----3 */ float points[]={ 0.0,0.0,0.0, 0.0,1.0,0.0, 1.0,1.0,0.0, 1.0,0.0,0.0, 0.0,0.0,1.0, 0.0,1.0,1.0, 1.0,1.0,1.0, 1.0,0.0,1.0 }; float normals[]={ 0.0,-1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0,-1.0 }; int faces[]={ 1,2,6,5, 2,3,7,6, 3,0,4,7, 0,1,5,4, 0,3,2,1, 5,6,7,4 }; float *xyz; float *normal; int *faceptr; float increment=0.0; for(i=0;i<8;i++){ xyz = points + 3*i; xyz[0] = 3.0*(xyz[0]-0.5) + camera_current->eye[0]; xyz[1] = 3.0*(xyz[1]-0.5) + camera_current->eye[1]; xyz[2] = 3.0*(xyz[2]-0.5+increment) + camera_current->eye[2]; } glDisable(GL_BLEND); glDepthMask(GL_FALSE); glDisable(GL_DEPTH_TEST); glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); glEnable(GL_TEXTURE_2D); for(i=0;i<6;i++){ if(skyboxinfo->face[i].file==NULL)continue; glBindTexture(GL_TEXTURE_2D,skyboxinfo->face[i].name); glBegin(GL_QUADS); normal = normals + 3*i; faceptr = faces + 4*i; glNormal3fv(normal); glTexCoord2f(0.0,0.0); xyz = points + 3*faceptr[0]; glVertex3fv(xyz); glTexCoord2f(1.0,0.0); xyz = points + 3*faceptr[1]; glVertex3fv(xyz); glTexCoord2f(1.0,1.0); xyz = points + 3*faceptr[2]; glVertex3fv(xyz); glTexCoord2f(0.0,1.0); xyz = points + 3*faceptr[3]; glVertex3fv(xyz); glEnd(); } glDisable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glEnable(GL_BLEND); draw_floor(); }
void DisplayWindow() { glClearColor(0.4, 0.4, 0.8, 1); glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT); glUniform1i(glGetUniformLocation(g_shader, "draw_cow"), 1); draw_cow(&cow, g_shader); glUniform1i(glGetUniformLocation(g_shader, "draw_cow"), 0); glUniform1i(glGetUniformLocation(g_shader, "draw_floor"), 1); draw_floor(&f, g_shader); glUniform1i(glGetUniformLocation(g_shader, "draw_floor"), 0); /* glUniform1i(glGetUniformLocation(g_shader, "draw_ball"), 1); draw_ball(&ball, g_shader); glUniform1i(glGetUniformLocation(g_shader, "draw_ball"), 0); draw_wall(&wall, g_shader); */ //draw_ragdoll(&ragdoll, g_shader); glUniform1i(glGetUniformLocation(g_shader, "draw_farmer"), 1); //glEnable (GL_BLEND); //glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //glDisable(GL_DEPTH_TEST); //draw_farmer(&farmer, g_shader); //glEnable(GL_DEPTH_TEST); //glDisable(GL_BLEND); glUniform1i(glGetUniformLocation(g_shader, "draw_farmer"), 0); glUniform1i(glGetUniformLocation(g_shader, "draw_plank"), 1); //draw_plank(&p, g_shader); draw_fence(&ff, g_shader); glUniform1i(glGetUniformLocation(g_shader, "draw_plank"), 0); //draw_debug_sphere(&ball, wall.bb.pos, g_shader); draw_debug_sphere(&ball, cow.head_pos, g_shader); int i; for(i=0;i < 8;i++) { draw_debug_sphere(&ball, cow.bb.vertices[i], g_shader); draw_debug_sphere(&ball, wall.bb.vertices[i], g_shader); } //draw_debug_sphere(&ball, VectorAdd(cow.bb.pos, cow.bb.size), g_shader); /* int i; for(i=0; i<4;i++) { draw_joint(&foot_joint[i], g_shader); draw_joint(&knee_joint[i], g_shader); draw_joint(&thigh_joint[i], g_shader); draw_joint(&legbase_joint[i], g_shader); draw_joint(&tail_joint[i], g_shader); if(i < 3) { draw_joint(&head_joint[i], g_shader); draw_joint(&body_joint[i], g_shader); } } */ //draw_bone(&bone, g_shader); glutSwapBuffers(); //printf("runrunrun\n"); }
static void draw_scene(GLFWwindow* window, double t) { double xpos, ypos, zpos, angle_x, angle_y, angle_z; static double t_old = 0.0; float dt; // Calculate frame-to-frame delta time dt = (float) (t - t_old); t_old = t; glClearColor(0.1f, 0.1f, 0.1f, 1.f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(65.0, aspect_ratio, 1.0, 60.0); // Setup camera glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Rotate camera angle_x = 90.0 - 10.0; angle_y = 10.0 * sin(0.3 * t); angle_z = 10.0 * t; glRotated(-angle_x, 1.0, 0.0, 0.0); glRotated(-angle_y, 0.0, 1.0, 0.0); glRotated(-angle_z, 0.0, 0.0, 1.0); // Translate camera xpos = 15.0 * sin((M_PI / 180.0) * angle_z) + 2.0 * sin((M_PI / 180.0) * 3.1 * t); ypos = -15.0 * cos((M_PI / 180.0) * angle_z) + 2.0 * cos((M_PI / 180.0) * 2.9 * t); zpos = 4.0 + 2.0 * cos((M_PI / 180.0) * 4.9 * t); glTranslated(-xpos, -ypos, -zpos); glFrontFace(GL_CCW); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); setup_lights(); glEnable(GL_LIGHTING); glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_EXP); glFogf(GL_FOG_DENSITY, 0.05f); glFogfv(GL_FOG_COLOR, fog_color); draw_floor(); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glDepthMask(GL_TRUE); draw_fountain(); glDisable(GL_LIGHTING); glDisable(GL_FOG); // Particles must be drawn after all solid objects have been drawn draw_particles(window, t, dt); // Z-buffer not needed anymore glDisable(GL_DEPTH_TEST); }
void render_scene(void) { float angle = timer.GetElapsedSeconds() * 3.14f / 10.0f; location[0] = -8.0f * cos(angle / 2.0f); location[1] = -8.0f * sin(angle / 2.0f); location[2] = 5.0f; light_0.position[0] = 10.0f * cos(-angle); light_0.position[1] = 10.0f * sin(-angle); light_0.position[2] = 3.0f; look_at(camera_frame, location, target, up_dir); camera_frame.GetCameraMatrix(camera_matrix); p_stack.LoadMatrix(view_frustum.GetProjectionMatrix()); mv_stack.LoadMatrix(camera_matrix); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); //-- glUseProgram(shader_color); mv_stack.PushMatrix(); mv_stack.Translate(light_0.position[0], light_0.position[1], light_0.position[2]); mv_stack.Scale(0.25f, 0.25f, 0.25f); glUniformMatrix4fv(mvp_matrix_location_shader_color, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix()); draw_light(); mv_stack.PopMatrix(); //-- glUseProgram(shader_light); glUniformMatrix3fv(normal_matrix_location, 1, GL_FALSE, geometry_pipeline.GetNormalMatrix()); glUniformMatrix4fv(v_matrix_location, 1, GL_FALSE, camera_matrix); glUniform3fv(intensity_ambient_component_location, 1, intensity_ambient_component); glUniform3fv(light_0_position_location, 1, light_0.position); glUniform3fv(light_0_intensity_diffuse_location, 1, light_0.intensity_diffuse); glUniform3fv(light_0_intensity_specular_location, 1, light_0.intensity_specular); glUniform3fv(light_0_attenuation_location, 1, light_0.attenuation); glUniform1f(material_0_ka_location, material_0.ka); glUniform1f(material_0_kd_location, material_0.kd); glUniform1f(material_0_ks_location, material_0.ks); glUniform1f(material_0_alpha_location, material_0.alpha); //-- glUniformMatrix4fv(mvp_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix()); glUniformMatrix4fv(mv_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewMatrix()); draw_grid(); draw_floor(); //-- for(int i = -20; i < 20; i += 5) { for(int j = -20; j < 20; j += 5) { mv_stack.PushMatrix(); mv_stack.Translate((float)i, (float)j, 0.0f); glUniformMatrix4fv(mvp_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix()); glUniformMatrix4fv(mv_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewMatrix()); draw_pyramid(); mv_stack.PopMatrix(); } } //-- mv_stack.PushMatrix(); mv_stack.Translate(0.0f, 0.0f, 4.0f); glUniformMatrix4fv(mvp_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix()); glUniformMatrix4fv(mv_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewMatrix()); draw_icosahedron(20, vertices_icosahedron, faces_icosahedron); mv_stack.PopMatrix(); //-- mv_stack.PushMatrix(); mv_stack.Translate(-5.0f, 0.0f, 4.0f); glUniformMatrix4fv(mvp_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewProjectionMatrix()); glUniformMatrix4fv(mv_matrix_location, 1, GL_FALSE, geometry_pipeline.GetModelViewMatrix()); draw_icosahedron_smooth(20, vertices_icosahedron, faces_icosahedron); mv_stack.PopMatrix(); //-- glUseProgram(0); glutSwapBuffers(); glutPostRedisplay(); }
int main(int ac, char **av) { t_gen gen; int f_level, error; t_pj pj; SDL_Surface *back = NULL, *grd = NULL, *hit_box = NULL; SDL_Texture *b_tex, *g_tex, *hb; SDL_Rect pj_box; SDL_Init(SDL_INIT_VIDEO); gen.win = SDL_CreateWindow( "test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 940, 680, SDL_WINDOW_RESIZABLE); gen.screen = SDL_GetWindowSurface(gen.win); gen.render = SDL_CreateRenderer(gen.win, -1, SDL_RENDERER_ACCELERATED); gen.gold = 0; gen.cmod = 0; gen.cflag = 0; gen.rgb = (unsigned int *)malloc(sizeof(unsigned int) * 3); gen.rgb[0] = 100; gen.rgb[1] = 100; gen.rgb[2] = 100; gen.pj = load_pj(&pj); pj.ani = anim_init(2, 2, IDLE_FLEN); // back = IMG_Load("img/forest.gif"); // b_tex = SDL_CreateTextureFromSurface(gen.render, back); // draw_backg(b_tex, back, gen.render, gen.screen, -1); grd = IMG_Load("img/ground.jpg"); g_tex = SDL_CreateTextureFromSurface(gen.render, grd); pj_init(&gen, &pj, "img/pj/"); ft_putendl("#### PJ_TEXT_DONE"); pj.box = &pj_box; f_level = gen.screen->h * 0.75; pj.box->x = gen.screen->w / 2 - 50; pj.box->y = f_level - 140; pj.box->w = 100; pj.box->h = 140; hit_box = SDL_CreateRGBSurface(0, 100, 140, 32, 0, 0, 0, 0); SDL_FillRect(hit_box, NULL, SDL_MapRGB(gen.screen->format, 0, 0, 255)); hb = SDL_CreateTextureFromSurface(gen.render, hit_box); SDL_SetTextureBlendMode(hb,SDL_BLENDMODE_BLEND); if ((error = SDL_SetTextureAlphaMod(hb, 100))) printf("Alpha for HB problem -> ERR_CODE = %d\n", error); // pausing(); (void)b_tex; (void)g_tex; (void)pj_box; // ##############################################################" float i = 0; char maj = 0; int continuer = 1; int orient = 0; int act = 0; clock_t clok; clok = clock(); SDL_Event event; get_key(); while (continuer) { SDL_PollEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; break; case SDL_KEYUP: switch(event.key.keysym.sym) { case 1073742049: maj = 0; break; case 27: continuer = 0; break; case 1073741904: i = act = 0; break; case 1073741903: i = act = 0; break; } break; case SDL_KEYDOWN: switch(event.key.keysym.sym) { case 1073742049: maj = 1; break; case 1073741904: orient = 1; if (act!=1) i = 0; act = 1; break; case 1073741903: orient = 0; if (act!=1) i = 0; act = 1; break; case 49: if (maj) {gen.gold = (gen.gold + 1) % 2;pj_init(&gen, &pj, "img/pj/");} else { pj.state[1][2]++; if (pj.state[1][2] > 2) pj.state[1][2] = 0; pj_init(&gen, &pj, "img/pj/");} break; case 50: pj.state[1][3]++; if (pj.state[1][3] > 2) pj.state[1][3] = 0; pj_init(&gen, &pj, "img/pj/"); break; case 114: gen.cmod = 0; break; case 103: gen.cmod = 1; break; case 98: gen.cmod = 2; break; case 1073741899: if(gen.rgb[gen.cmod] <= 250){ gen.rgb[gen.cmod] += 5; gen.cflag = 1; pj_init(&gen, &pj, "img/pj/"); gen.cflag = 0; } break; case 1073741902: if(gen.rgb[gen.cmod] >= 5){ gen.rgb[gen.cmod] -= 5; gen.cflag = 1; pj_init(&gen, &pj, "img/pj/"); gen.cflag = 0; } break; } break; } if (clock() > clok + 100) { // printf("i = %d\n",(int)i); clok = clock(); draw_backg(gen.render, gen.screen); draw_floor(g_tex, grd, f_level, gen.render, gen.screen,(act)? orient : -1); SDL_RenderCopy(gen.render, pj.ani[act][orient][(int)i], NULL, pj.box); SDL_RenderPresent(gen.render); i += (act) ? 0.50 : 0.04; // printf("i = %f ===> %d\n",i,(int)i); if (i > 1.30 && !act) i = 0; else if (i > 5) i = 0; // Pausing (); } event.key.keysym.sym = 0; } SDL_Quit(); (void)ac; (void)av; (void)act; (void)back; (void)gfxPrimitivesFontdata; return (0); }
void draw_scene() { static float ang_self = 0.0; /*Define the angle of self-rotate */ static float angle = 0.0; glLightfv(GL_LIGHT4, GL_POSITION, lit4_position); glLightfv(GL_LIGHT4, GL_SPOT_DIRECTION, lit4_direction); glLightfv(GL_LIGHT5, GL_POSITION, lit5_position); glLightfv(GL_LIGHT5, GL_SPOT_DIRECTION, lit5_direction); glLightfv(GL_LIGHT1, GL_POSITION, lit1_position); /*fixed position---*/ glDisable(GL_TEXTURE_2D); draw_floor(); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(0.0, 0.0, 0.0); glMatrixMode(GL_MODELVIEW); draw_slope(); draw_axes(); draw_object(); /*-------Draw the billboard ----*/ glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, textName[2]); glEnable(GL_TEXTURE_2D); draw_billboard(5.0*4.0, -3.0*4.0, 5.0, 8.0); draw_billboard(6.0*4.0, -5.0*4.0, 5.0, 8.0); draw_billboard(3.0*4.0, -6.0*4.0, 5.0, 8.0); draw_billboard(2.0*4.0, -7.0*4.0, 5.0, 8.0); draw_billboard(7.0*4.0, -2.0*4.0, 5.0, 8.0); glDisable(GL_TEXTURE_2D); /*-------Draw the car body which is a cube----*/ glTranslatef(position[0], position[1], position[2]); glRotatef(-up_ang, 1.0, 0.0, 0.0); glRotatef(self_ang, 0.0, 1.0, 0.0); glPushMatrix(); /* Save M1 coord. sys */ draw_cube(); glPopMatrix(); /* Get M1 back */ /*-------Draw the front wheels -----*/ glColor3f(1.0, 0.0, 0.0); glPushMatrix(); /* Save M1 coord. sys */ glTranslatef(-4.0, 0.0, 3.0); /* Go to left wheel position */ glutSolidTorus(0.5, /* inner radius */ 1.0, /* outer radius */ 24, /* divided into 18 segments */ 12); /* 12 rings */ glPopMatrix(); glPushMatrix(); /* Save M1 coord. sys */ glTranslatef(-4.0, 0.0, -3.0);/* Go to right wheel position */ glutSolidTorus(0.5, /* inner radius */ 1.0, /* outer radius */ 24, /* divided into 18 segments */ 12); /* 12 rings */ glPopMatrix(); /*------Draw back wheels ----*/ glColor3f(1.0, 0.4, 0.0); glPushMatrix(); /* Save M1 coord. sys */ glTranslatef(6.0, 0.0, 0.0); /* Go to left wheel position */ glutSolidTorus(0.5, /* inner radius */ 1.0, /* outer radius */ 24, /* divided into 18 segments */ 12); /* 12 rings */ glPopMatrix(); glColor3f(1.0, 0.4, 0.4); glPushMatrix(); /* Save M1 coord. sys */ glTranslatef(0.0, 1.5, 7.5); /* Go to left wheel position */ glRotatef(-90.0, 1.0, 0.0, 0.0); glutSolidTorus(0.5, /* inner radius */ 3.0, /* outer radius */ 24, /* divided into 18 segments */ 12); /* 12 rings */ glPopMatrix(); glColor3f(1.0, 0.4, 0.4); glPushMatrix(); /* Save M1 coord. sys */ glTranslatef(0.0, 1.5, -7.5); /* Go to left wheel position */ glRotatef(-90.0, 1.0, 0.0, 0.0); glutSolidTorus(0.5, /* inner radius */ 3.0, /* outer radius */ 24, /* divided into 18 segments */ 12); /* 12 rings */ glPopMatrix(); glColor3f(1.0, 1.0, 1.0); glPushMatrix(); glTranslatef(0.0, 1.5, 7.5); glRotatef(bld_ang, 0.0, 1.0, 0.0); draw_blade();/* draw the first blade */ glRotatef(120, 0.0, 1.0, 0.0); draw_blade();/* draw the first blade */ glRotatef(120, 0.0, 1.0, 0.0); draw_blade();/* draw the first blade */ glPopMatrix(); glColor3f(1.0, 1.0, 1.0); glPushMatrix(); glTranslatef(0.0, 1.5, -7.5); glRotatef(bld_ang, 0.0, 1.0, 0.0); draw_blade(); glRotatef(120, 0.0, 1.0, 0.0); draw_blade(); glRotatef(120, 0.0, 1.0, 0.0); draw_blade(); glPopMatrix(); }