Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glNormal3f(0, 0, 1);
- glColor4fv(colour_);
- glBegin(GL_POLYGON); //Naive. Why are triangles better?
- glVertex3f(53.0, -20.0, 0);
- glVertex3f(53.0, 18.0, 0);
- glVertex3f(25.0, 40.0, 0);
- glVertex3f(-10.0, 40, 0);
- glVertex3f(-30.0, 35, 0);
- glVertex3f(-60.0, 20, 0);
- glVertex3f(-70.0, 15, 0);
- glVertex3f(-80.0, 12, 0);
- glVertex3f(-80.0, -10, 0);
- glVertex3f(-60.0, -15, 0);
- glEnd();
- // Salmon tail (sans fins).
- glBegin(GL_TRIANGLES);
- glVertex3f(-80.0, 12, 0);
- glVertex3f(-130.0, 30, 0);
- glVertex3f(-80.0, -10, 0);
- glVertex3f(-80.0, 12, 0);
- glVertex3f(-130.0, -30, 0);
- glVertex3f(-80.0, -10, 0);
- glEnd();
- // Salmon belly, dorsal fins, and contours (lighter).
- float belly_[] = { 0.98, 0.45, 0.04, 1.0 };
- glColor4fv(belly_);
- glPushMatrix();
- glScalef(1, 0.4, 0.0);
- glBegin(GL_POLYGON);
- for (double i = (6.8 / 6 ) * M_PI; i < 1.9 * M_PI; i += M_PI / 6) {
- glVertex3f(cos(i) * (1.2 * length_), sin(i) * length_, 0.0);
- }
- glEnd();
- glPopMatrix();
- glBegin(GL_TRIANGLES);
- glVertex3f(-40.0, 25, 0);
- glVertex3f(-70.0, 10, 0);
- glVertex3f(-80.0, 10, 0);
- glVertex3f(25.0, -5.0, 0);
- glVertex3f(45.0, 20.0, 0);
- glVertex3f(35.0, 15.0, 0);
- glVertex3f(-90.0, 0, 0);
- glVertex3f(-130.0, 30, 0);
- glVertex3f(-110.0, 0, 0);
- glVertex3f(-90.0, 0, 0);
- glVertex3f(-130.0, -30, 0);
- glVertex3f(-110.0, 0, 0);
- glVertex3f(-60.0, 20, 0);
- glVertex3f(-70.0, 15, 0);
- glVertex3f(-75.0, 22, 0);
- glVertex3f(-10.0, 40, 0);
- glVertex3f(-30.0, 35, 0);
- glVertex3f(-30.0, 60, 0);
- glVertex3f(-30.0, 35, 0);
- glVertex3f(-30.0, 60, 0);
- glVertex3f(-50.0, 35, 0);
- glVertex3f(-30.0, 35, 0);
- glVertex3f(-40.0, 30, 0);
- glVertex3f(-50.0, 35, 0);
- glEnd();
- // Green lowlights.
- float lowlights_[] = { 0.17, 0.49, 0.27, 1.0 };
- glColor4fv(lowlights_);
- glBegin(GL_TRIANGLES);
- glVertex3f(-85.0, 0, 0);
- glVertex3f(-125.0, -28, 0);
- glVertex3f(-90.0, 0, 0);
- glEnd();
- // Green highlights.
- float highlights_[] = { 0.37, 0.67, 0.35, 1.0 };
- glColor4fv(highlights_);
- glBegin(GL_TRIANGLES);
- glVertex3f(-90.0, 0, 0);
- glVertex3f(-130.0, 30, 0);
- glVertex3f(-110.0, 0, 0);
- glVertex3f(-90.0, 0, 0);
- glVertex3f(-130.0, -30, 0);
- glVertex3f(-110.0, 0, 0);
- glEnd();
- // Salmon fins (same colour as body to contrast with belly).
- glColor4fv(colour_);
- glBegin(GL_TRIANGLES);
- glVertex3f(40.0, -15.0, 0);
- glVertex3f(15.0, -20.0, 0);
- glVertex3f(30.0, -40, 0);
- glVertex3f(0.0, -25.0, 0);
- glVertex3f(-20.0, -25.0, 0);
- glVertex3f(-25.0, -35, 0);
- glVertex3f(-60.0, -20, 0);
- glVertex3f(-70.0, -15, 0);
- glVertex3f(-75.0, -22, 0);
- glEnd();
- // Face and top mandible (greenish).
- float face_[] = { 0.37, 0.67, 0.35, 1.0 };
- glColor4fv(face_);
- glNormal3f(0, 0, 1);
- glBegin(GL_TRIANGLES);
- glVertex3f(35.0, -5.0, 0);
- glVertex3f(55.0, 17.0, 0);
- glVertex3f(100.0, 10, 0);
- glVertex3f(35.0, -5.0, 0);
- glVertex3f(100.0, 10, 0);
- glVertex3f(60.0, -17, 0);
- glVertex3f(100.0, 10, 0);
- glVertex3f(93.0, -5, 0);
- glVertex3f(86.0, 10, 0);
- glEnd();
- // Lower mandible (darker green).
- float jaw_[] = { 0.17, 0.49, 0.27, 1.0 };
- glColor4fv(jaw_);
- glBegin(GL_TRIANGLES);
- glVertex3f(37.0, -7.0, 0);
- glVertex3f(37.0, -25.0, 0);
- glVertex3f(75.0, -22, 0);
- glVertex3f(55.0, -20.0, 0);
- glVertex3f(100.0, -10.0, 0);
- glVertex3f(75.0, -22, 0);
- glEnd();
- // Eye
- glPushMatrix();
- glTranslatef(50, 0, 0);
- const float white[] = {1.0, 1.0, 1.0, 1.0};
- glColor4fv(white);
- glNormal3f(0, 0, 1);
- glBegin(GL_POLYGON);
- for (double i = 0.0; i < 2 * M_PI; i += M_PI / 6)
- glVertex3f(cos(i) * 4, sin(i) * 4, 0.0);
- glEnd();
- glTranslatef(1, 0, 0);
- const float black[] = {0.0, 0.0, 0.0, 1.0};
- glColor4fv(black);
- glNormal3f(0, 0, 1);
- glBegin(GL_POLYGON);
- for (double i = 0.0; i < 2 * M_PI; i += M_PI / 6)
- glVertex3f(cos(i) * 2, sin(i) * 2, 0.0);
- glEnd();
- glPopMatrix();
- // Restore the transformation matrix.
- glPopMatrix();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement