Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making an Ice Cream Cone

Similar presentations


Presentation on theme: "Making an Ice Cream Cone"— Presentation transcript:

1 Making an Ice Cream Cone
How to build Making an Ice Cream Cone

2 Take a piece of paper, lay it on the desk, and draw the x and z axes on it.
Label it with +x, -x, +z, -z +x is to the right +z is toward you

3 Start with a copy of box.cpp
Notice the viewing box   glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0); Notice everything is being translates back 15 units glTranslatef(0.0, 0.0, -15.0); Comment out the line that creates a box Replace it with code that makes one fat red point at the origin. Run it and see that it is working

4 Some building blocks: glutWireSphere(radius, slices, stacks); glutWireCone(base, height, slices, stacks);

5 Below making the red dot, make a green cone, vertex down.
you will need to rotate it glRotated(angle, x, y,z); put glPushMatrix and glPopMatrix around the rotation and the cone. run it and see where it is relative to the dot.

6 Below making the cone, make a sphere of the same radius. Pick a flavor
Below making the cone, make a sphere of the same radius. Pick a flavor. Translate it, if necessary, to be sitting inside and above the cone. glTranslated(x,y,z); run it

7 Below making the icecream, make a cherry on top, a solid sphere of a small radius. Translate it to be sitting on top of the ice cream. Around the translate and making the little sphere put glPushMatrix and glPopMatrix. Run it.

8 Translate the entire icecream cone 5 units to the right.
Using pushMatrix and popMatrix, have that translation only apply to the icecream cone.

9 Notice the icecream appears to be in front of the cone, not in it
Notice the icecream appears to be in front of the cone, not in it. Add depth. In main:    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); In drawscene: glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST);


Download ppt "Making an Ice Cream Cone"

Similar presentations


Ads by Google