diff options
author | Eric Anholt <eric@anholt.net> | 2009-07-28 16:46:03 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-07-28 16:46:03 -0700 |
commit | 02f26e9129b85708921a5037f247d24b7bc37574 (patch) | |
tree | 7f70815ea8201b51fb4c883230d047f238713260 | |
parent | 9341987710b28129a3f86287a0e47c235f97e0dc (diff) |
Move to new GLU3 API.
-rw-r--r-- | glass.c | 47 | ||||
-rw-r--r-- | ground.c | 2 |
2 files changed, 25 insertions, 24 deletions
@@ -146,12 +146,12 @@ update_light_position(void) */ light_rotation_rads = cur_time * 2 * M_PI / 4; - light_eye_matrix = gluRotate4v(&z_axis, light_rotation_rads); - temp = gluTranslate3(-eye_world.values[0], + gluRotate4v(&light_eye_matrix, &z_axis, light_rotation_rads); + gluTranslate3(&temp, -eye_world.values[0], -eye_world.values[1], -eye_world.values[2]); - gluMult4m_4m(&temp, &light_eye_matrix); - light_eye = gluMult4m_4v(&light_eye_matrix, &light_start_world); + gluMult4m_4m(&light_eye_matrix, &temp, &light_eye_matrix); + gluMult4m_4v(&light_eye, &light_eye_matrix, &light_start_world); light_eye.values[0] /= light_eye.values[3]; light_eye.values[1] /= light_eye.values[3]; @@ -197,33 +197,34 @@ calc_new_ring_transforms(int instance) GLUmat4 obj_to_world, temp; /* Have the ring spinning on its axis slowly. */ - obj_to_world = gluRotate4v(&z_axis, cur_time * 2 * M_PI / 20); + gluRotate4v(&obj_to_world, &z_axis, cur_time * 2 * M_PI / 20); /* Make them wobble a little over time. */ - temp = gluRotate4v(&x_axis, M_PI / 8 * sin(cur_time * 2 * M_PI / 3)); - obj_to_world = gluMult4m_4m(&temp, &obj_to_world); + gluRotate4v(&temp, &x_axis, M_PI / 8 * sin(cur_time * 2 * M_PI / 3)); + gluMult4m_4m(&obj_to_world, &temp, &obj_to_world); - temp = gluRotate4v(&y_axis, M_PI / 16 * sin(cur_time * 2 * M_PI / 5)); - obj_to_world = gluMult4m_4m(&temp, &obj_to_world); + gluRotate4v(&temp, &y_axis, M_PI / 16 * sin(cur_time * 2 * M_PI / 5)); + gluMult4m_4m(&obj_to_world, &temp, &obj_to_world); /* Have the vertical rows start with different alignments. */ switch (z_index) { case 0: break; case 1: - temp = gluRotate4v(&x_axis, M_PI / 4); - obj_to_world = gluMult4m_4m(&temp, &obj_to_world); + gluRotate4v(&temp, &x_axis, M_PI / 4); + gluMult4m_4m(&obj_to_world, &temp, &obj_to_world); break; case 2: - temp = gluRotate4v(&x_axis, -M_PI / 4); - obj_to_world = gluMult4m_4m(&temp, &obj_to_world); + gluRotate4v(&temp, &x_axis, -M_PI / 4); + gluMult4m_4m(&obj_to_world, &temp, &obj_to_world); break; } /* Move them out into their position in the cube. */ - temp = gluTranslate3(x_index * 5.0, - 10 + y_index * 5.0, - 7.0 + z_index * 5.0); - ring_obj_to_world[instance] = gluMult4m_4m(&temp, &obj_to_world); + gluTranslate3(&temp, + x_index * 5.0, + 10 + y_index * 5.0, + 7.0 + z_index * 5.0); + gluMult4m_4m(&ring_obj_to_world[instance], &temp, &obj_to_world); } static void @@ -232,8 +233,8 @@ install_transform(int instance) GLUmat4 mv, mvp; /* Generate the whole mvp */ - mv = gluMult4m_4m(&world_to_eye, &ring_obj_to_world[instance]); - mvp = gluMult4m_4m(&projection, &mv); + gluMult4m_4m(&mv, &world_to_eye, &ring_obj_to_world[instance]); + gluMult4m_4m(&mvp, &projection, &mv); glUniformMatrix4fv(uniforms[UNIFORM_MV].location, 1, 0, (float *)&mv); @@ -469,9 +470,9 @@ reshape(int width, int height) if (sdl_surf == NULL) errx(1, "video mode set fail\n"); - projection = gluPerspective4(80, - (float)win_width / (float)win_height, - 0.2, 40); + gluPerspective4(&projection, 80, + (float)win_width / (float)win_height, + 0.2, 40); } static GLint @@ -753,7 +754,7 @@ init(void) /* Have the eye out in the world, sitting above the ground on the * Z axis, looking down y. */ - world_to_eye = gluLookAt4v(&eye_world, &eye_center_world, &z_axis); + gluLookAt4v(&world_to_eye, &eye_world, &eye_center_world, &z_axis); setup_ground(); @@ -54,7 +54,7 @@ install_ground_transform(void) { GLUmat4 mvp; - mvp = gluMult4m_4m(&projection, &world_to_eye); + gluMult4m_4m(&mvp, &projection, &world_to_eye); glUniformMatrix4fv(ground_uniforms[GROUND_UNIFORM_MV].location, 1, 0, (float *)&world_to_eye); |