summaryrefslogtreecommitdiff
path: root/glass.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-06-17 17:05:51 -0700
committerEric Anholt <eric@anholt.net>2009-06-17 17:05:51 -0700
commit0f5e3969b957f71315104ab6814338f8c84d66f4 (patch)
tree0ac3e44f8852e52b9971c3501f2a21c5e79c3173 /glass.c
parentf233055d5a520233f782e24dc282b9de03878667 (diff)
Draw more instances of the model.
Diffstat (limited to 'glass.c')
-rw-r--r--glass.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/glass.c b/glass.c
index e536df2..3bb1e30 100644
--- a/glass.c
+++ b/glass.c
@@ -177,6 +177,10 @@ do_ring_drawelements(void)
static void
install_transform(int instance)
{
+ int x_index = (instance / 3) / 3 - 1;
+ int y_index = (instance / 3) % 3 - 1;
+ int z_index = instance % 3;
+
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -184,18 +188,17 @@ install_transform(int instance)
/* Translate for eye location. */
glTranslatef(-eye_world[0], -eye_world[1], -eye_world[2]);
- switch (instance) {
+ /* Move some of them left/right. */
+ glTranslatef(x_index * 8.0, y_index * 6.0, z_index * -6.0);
+
+ switch (z_index) {
case 0:
break;
case 1:
- /* Move it back a bit. */
- glTranslatef(0, 0, -6);
/* Turn it a little on the X axis. */
glRotatef(45, 1, 0, 0);
break;
case 2:
- /* Move it back a farther. */
- glTranslatef(0, 0, -12);
/* Turn it a little the other way on the X axis. */
glRotatef(-45, 1, 0, 0);
break;
@@ -216,7 +219,7 @@ install_transform(int instance)
static void
draw(void)
{
- int i, j, instance;
+ int instance;
glClearColor(0.0, 0.0, 0.8, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -248,7 +251,7 @@ draw(void)
glViewport(0, 0, win_width, win_height);
- for (instance = 0; instance < 3; instance++) {
+ for (instance = 0; instance < 27; instance++) {
install_transform(instance);
do_ring_drawelements();
}