void fractalTree(int level) { long savedseed; if (level == MAX_LEVEL) { glPushMatrix(); glRotatef(random_number() * 180, 0, 1, 0); glCallList(STEMANDLEAVES); glPopMatrix(); } else { glCallList(STEM); glPushMatrix(); glRotatef(random_number() * 180, 0, 1, 0); glTranslatef(0, 1, 0); glScalef(0.7, 0.7, 0.7); glPushMatrix(); glRotatef(110 + random_number() * 40, 0, 1, 0); glRotatef(30 + random_number() * 20, 0, 0, 1); fractalTree(level + 1); glPopMatrix();glPushMatrix(); glRotatef(-130 + random_number() * 40, 0, 1, 0); glRotatef(30 + random_number() * 20, 0, 0, 1); fractalTree(level + 1); glPopMatrix();glPushMatrix(); glRotatef(-20 + random_number() * 40, 0, 1, 0); glRotatef(30 + random_number() * 20, 0, 0, 1); fractalTree(level + 1); glPopMatrix(); glPopMatrix(); } }