IAS2233_Lab09 - IAS 2233 COMPUTER GRAPHICS SEMESTER...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Prepared by: Miss Rosnita/FIIT 1 IAS 2233 : COMPUTER GRAPHICS SEMESTER 3/2010/2011 LAB 09 1) Below is the example code of drawing wired objects (using transformation). Type and see the result. #include <windows.h> #include <gl/Gl.h> #include <gl/Glu.h> #include <gl/glut.h> //<<<<<<<<<<<<<<<<<<< axis >>>>>>>>>>>>>> void axis(double length) { // draw a z-axis, with cone at end glPushMatrix(); glBegin(GL_LINES); glVertex3d(0, 0, 0); glVertex3d(0,0,length); // along the z-axis glEnd(); glTranslated(0, 0,length -0.2); glutWireCone(0.04, 0.2, 12, 9); glPopMatrix(); } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<< displayWire >>>>>>>>>>>>>>>>>>>>>> void displayWire(void) { glMatrixMode(GL_PROJECTION); // set the view volume shape glLoadIdentity(); glOrtho(-2.0*64/48.0, 2.0*64/48.0, -2.0, 2.0, 0.1, 100); glMatrixMode(GL_MODELVIEW); // position and aim the camera glLoadIdentity(); gluLookAt(2.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); // clear the screen glColor3d(0,0,0); // draw black lines axis(0.5); // z-axis glPushMatrix(); glRotated(90, 0,1.0, 0); axis(0.5); // y-axis glRotated(-90.0, 1, 0, 0); axis(0.5); // z-axis glPopMatrix();
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Prepared by: Miss Rosnita/FIIT 2 glPushMatrix(); glTranslated(0.5, 0.5, 0.5); // big cube at (0.5, 0.5, 0.5) glutWireCube(1.0); glPopMatrix(); glPushMatrix(); glTranslated(1.0,1.0,0);
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern