1 / 17

CS430 Computer Graphics

CS430 Computer Graphics. Hierarchical Graphics. Topics. Hierarchical Geometric Models Graphics Client and Server Graphics Package Modes Display List in OpenGL. Hierarchical Geometric Models. Model Representation of some (of all) features of a concrete or abstract entity Purposes

Download Presentation

CS430 Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS430 Computer Graphics Hierarchical Graphics Chi-Cheng Lin, Winona State University

  2. Topics • Hierarchical Geometric Models • Graphics Client and Server • Graphics Package Modes • Display List in OpenGL

  3. Hierarchical Geometric Models • Model • Representation of some (of all) features of a concrete or abstract entity • Purposes • Visualization and understanding of structures or behavior of an entity • Experimentation with and prediction of effects of inputs or changes to the model • Models in computer graphics • Organizational models • Quantitative models • Geometric models

  4. Hierarchical Geometric Models • Geometric model • Collection of components with well-defined geometry and interconnections between components • Representation of • Spatial layout, shape, appearance • Connectivity of components • Application-specific data values and properties

  5. Hierarchical Geometric Models • Purpose of hierarchy • Modularization • Storage economy • Update propagation • Hierarchy in geometric modeling • Complex objects can be built using application-specific atomic components • Symbolized by various tree structures or DAG (Directed Acyclic Graph) • Parent calls child and passes geometric parameters to child

  6. S Hierarchical Geometric Models • Example Tree DAG robot robot upperBody leg leg upperBody leg arm arm arm hand hand hand

  7. Hierarchical Geometric Models • Child-sibling tree (a binary tree) is used to represent the tree hierarchy • Preorder traversal is used for rendering • Example: robot // upperBody leg leg // arm arm // hand // hand //

  8. Graphics Client and Server • Client • Host computer running graphics programs • Server • Workstation with a raster display, a keyboard, and pointing device • Provides output services on its display • Provides input services through the keyboard and pointing device • Services potentially are available to client anywhere on the network

  9. Graphics Package Modes • Immediate mode • As soon as a statement that defines a primitive is executed, the primitive is displayed immediately • Keeps no record of primitives and attributes in memory • Client computes and passes data to server

  10. Graphics Package Modes • Retained mode • Define an object once and put its description in a display list • Display list is stored (cached) in the server and redisplayed by a function call issued from client to server

  11. Graphics Package Modes • Advantages of retained mode • Computation is reduced • Network traffic is reduced • Performance could be optimized, e.g., • Client: good numerical-processing computer • Server: special-purpose graphics computer • Disadvantages of retained mode • Extra server memory required • Overhead in creating and maintaining display lists • Not practical for applications with high dynamics

  12. Graphics Package Modes • Some graphics packages support only one of the modes, some supports both mode • Both modes are supported in OpenGL • Immediate mode is what we’ve been using • Retained mode: display list

  13. Display List in OpenGL • Define a display list of an upright, centralized, red cylinder GLuint myCylinder; myCylinder = glGenLists(1) if (myCylinder != 0) { glNewList(myCylinder, GL_COMPILE); redCylinder(1.0, 1.0, 2.0, 10, 8); glEndList(); } • Call (execute) a display list (e.g., indisplay()) glCallList(myCylinder); Compile and store, but don’t execute

  14. Display List in OpenGL • Definition of a red cylinder GLUquadricObj *qobj; qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_LINE); static void redCylinder(GLdouble b, GLdouble t, GLdouble h, GLint slc, GLint stk) { glColor3f(1.0, 1.0, 1.0); glRotated(-90.0, 1.0, 0.0, 0.0); glTranslated(0, 0, -h/2); gluCylinder(qobj, b, t, h, slc, stk); }

  15. Display List in OpenGL • Problem • The state (e.g., color and transformation matrix) might be changed by a display list • Solution: save/restore state • At the beginning of a display list glPushMatrix(); glPushAttrib(GL_ALL_ATTRIB_BITS); • At the end of a display list glPopAttrib(); glPopMatrix();

  16. Hierarchical Display Lists • A list can call another list • Example • glNewList(bike, GL_COMPILE); glCallList(body); glTranslated(-0.5, 0, 0); glCallList(wheel); glTranslated(1.0, 0, 0); glCallList(wheel); glEndList();

  17. Display List in OpenGL • Once a display list is created it cannot be modified* • E.g., if you are going to rotate a wheel independently, do not include it in the list • Inflexible, but efficient • Use a display list for an atomic object • Matrix operations, lighting models, material properties, textures, patterns, may also be optimized using display list

More Related