Computer Graphics: Programming, Problem Solving, and Visual ...

Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College PowerPoint Instructors Resource Implementing Modeling in OpenGL Going from concepts to images

Modeling Topics Specifying geometry

GLU and GLUT tools Transformations Transformation Stack Drawing text Inverting the eyepoint transformation Display lists Specifying Geometry General model is glBegin(grouping_mode); vertex list

glEnd(); The grouping mode identifies how the vertices are to be used The vertices in the vertex list can be done manually or by computation Specifying Geometry (2) There are many different grouping modes that OpenGL recognizes Simple modes:

GL_POINTS GL_LINES GL_TRIANGLES GL_QUADS GL_POLYGON Specifying Geometry (3) Geometry compression modes: GL_LINE_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN

GL_QUAD_STRIP Specifying Geometry (4) Some details of OpenGL geometry: All OpenGL polygons are assumed to be convex Polygons use vertices as if they were from a triangle fan Quad strips use vertices as if they were for triangle strips, so the order is different from GL_QUADS

Specifying Geometry (5) The vertex list can use vertices of many different types The vertex data type is specified in the the particular glVertex* function name glVertex[2|3][i|f|d]{v} There are additional options, but they are not often used

Specifying Geometry (6) As you specify the geometry with the vertices, you can specify other data for each vertex (e.g. appearance data) glColor*() glNormal*() glTexCoord*() Vertices can be given individually or as vertex arrays, reducing function calls

Some Sample OpenGL Objects Triangle fan used to create a cone Triangle strips used to create a surface (one strip shown) Appearance Information Simple OpenGL drawing uses edges that are one pixel wide and are not antialiased

You can specify point sizes and line width You can antialias points, lines, and polygon edges glEnable(type) as appropriate glHint(type, value) Clipping Besides the automatic clipping on the view volume, you can specify other clipping by defining clip planes Clip planes are defined by the

coordinates in the plane equation glClipPlane(number,plane) Clip planes may be enabled or disabled as your program runs GLU Quadric Objects The GLU utilities include a number of useful objects gluSphere gluCylinder

gluDisk All require that you first create a general GLUquadric pointer: GLUquadric* gluNewQuadric(void) GLU Quadric Objects (2) GLU quadric objects are created by invoking a function that uses the GLUquadric* value The function also defines granularity and size You can select whether the object is solid or

wireframe You can specify if you want to have normals or texture coordinates generated automatically GLUT Objects GLUT provides a number of additional graphical objects you can use easily

Cone Sphere Cube Torus

Dodecahedron Icosahedron Octahedron Tetrahedron Teapot Each of these can be either wireframe or solid Examples of GLU and GLUT

Objects Transformations in OpenGL Rotation glRotatef(angle, x, y, z) Translation glTranslatef(tx, ty, tz) Scaling glScalef(sx, sy, sz)

Individually these are simple, but they can be composed to create complex transformations Transformation Stacks You can create a stack for any of the standard OpenGL transformations The modelview transformation stack is critically important to manage the scene graph

glMatrixMode(GL_MODELVIEW); glPushMatrix(); glPopMatrix(); Text in OpenGL Text is handled by a GLUT function that writes a character at a time in the font (usually bitmapped) you choose glutBitmapCharacter(font, char)

Text you create this way is simply placed on the screen and cannot be selected Inverting the Eyepoints We saw that it can be useful to move the eyepoint in your model Of course, you could call glutLookAt() with new viewing data each time you redraw the scene The viewing data uses raw coordinates,

though, and this could be difficult to calculate with many eye motions Inverting the Eyepoint (2) The eyepoint motion will probably be set by using simple transformations If these simple transformations are T1*T2*T3* *TN then their inverse is TN-1**T3-1*T2-1*T1-1

and each of the inverses is simple Inverting the Eyepoint (3) In order to make the eyepoint placement easy, you can simply apply the needed inverse transformations at the top of the scene graph (at the beginning of the display function) and then use the default view Creating Display Lists

Display lists are OpenGLs way to compile geometry This lets the system work on geometry that has been optimized, making it faster to draw complex objects glNewList(i); glEndList(); You can then use this geometry with glCallList(i);

Recently Viewed Presentations

  • HVM Crash Testing Standards Explained - HVMhub

    HVM Crash Testing Standards Explained - HVMhub

    Includes all-world threat vehicles contained in PAS 68 & ASTM F2656. Due for review 2017. Regulations Evaluating Impact Performance. Publicly Available Standard (PAS 68 - Latest version 2013. UK based threat vehicles. ... Impact Angle. Penetration.
  • Slaid 1 - Liikluskasvatus.ee

    Slaid 1 - Liikluskasvatus.ee

    Alles purukslastud kummid peatasid purjus noorte auto! 17- aastane Kalev võttis luba küsimata kasuisa auto, mida oli teinud ka varem. Eelnevalt ja ka autosõidu ajal tarvitati erinevaid alkohoolseid jooke. Sõideti Tartu linna, ei reageeritud politsei peatumismärguannetele. Alles purukslastud kummid peatasid...
  • Rotary District 1130

    Rotary District 1130

    Community and Vocational Service. In line with Rotary international there has been a split of the C&V team in RIBI to separate teams. This was to boost Vocational Service as one of the main "Avenues of Service"
  • Adjectives and Adverbs Adapted from Real Good Grammar,

    Adjectives and Adverbs Adapted from Real Good Grammar,

    Verbs. become remain appear seem. What is an adverb? An adverb is a word that describes, modifies, or intensifies a verb, an adjective, or another adverb. Most adverbs are formed with the addition of the -ly ...
  • Lesson 3: Machines - 7th Grade Science

    Lesson 3: Machines - 7th Grade Science

    Inclined plane - a flat, sloped surface. Ex: ramp. Brainpop - Inclined planes. Screw - an inclined plane wrapped around a cylinder. Ex: screw-top bottle (soda bottle) Wedge
  • PowerPoint Presentation

    PowerPoint Presentation

    Climate. Hot desert climates are exceptionally hot for long periods of the year. High temperatures of 113° Fahrenheit are not uncommon. During colder periods, night-time temperatures can drop down to freezing, but rarely drops far below freezing
  • An Improved Construction for Counting Bloom Filters

    An Improved Construction for Counting Bloom Filters

    Lots of parameters: number of hash functions, cells per bucket, fingerprint size, etc. Useful for flexible design. Fingerprint Compressed Filter (FCF) Example Experiment Summary FCF-based ACSM is the clear winner. Better performance than less space for the others in test...
  • ALA Presentation 6 July 2000 - University of Notre Dame

    ALA Presentation 6 July 2000 - University of Notre Dame

    CROSSWALK = MAPPING. Metadata from a Web site can be popped into a MARC format AND. Vice versa. Crosswalks map metadata in a header of an HTML document to the MARC format and/or to Dublin Core, a metadata standard.