void ShZshapeManager::end(const char* content) { if (content == "cube") { end_cube(); } if (content == "cylinder") { end_cylinder(); } if (content == "pipe") { end_pipe(); } if (content == "cone") { end_cone(); } if (content == "circle") { end_circle(); } if (content == "ring") { end_ring(); } if (content == "pyramid") { end_pyramid(); } if (content == "triangle") { end_triangle(); } if (content == "rectangle") { end_rectangle(); } if (content == "polygon") { end_polygon(); } if (content == "multigonalStar") { end_multigonalStar(); } }
static void draw(void) { GLfloat mat[16], projection[16]; struct cube c; /* Set modelview/projection matrix */ matrix_make_unity(mat); matrix_rotate_x(view_rotx, mat); matrix_rotate_y(view_roty, mat); matrix_rotate_z(view_rotz, mat); matrix_translate(0.0, 0.0, view_transz, mat); matrix_scale(view_scale, view_scale, view_scale, mat); matrix_make_projection(0.9, projection); //print_matrix(mat); glUniformMatrix4fv(u_projection, 1, GL_FALSE, projection); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); start_cube(); int a; for (a = 0; a < N_CUBES; a++) { // print_cube(&cubes[a]); update_cube(&cubes[a]); draw_a_cube(&cubes[a], mat); printf("a=%d\n",a); print_cube(&cubes[a]); } /* GLfloat i,j,k; #define LOW -4.0 #define HIGH 4.0 #define STEP 2.0 for (i = LOW; i < HIGH; i += STEP) { for (j = LOW; j < HIGH; j += STEP) { for (k = HIGH+10.0; k > LOW+10.0; k -= STEP) { draw_cube(i, j, k, 0.0, 0.0, 0.0, 1.0, mat); } } } #undef LOW #undef HIGH #undef STEP */ end_cube(); #undef N }