4. Geometric Objects, Transformations and Hierarchies

Jorg’s Graphics Lecture Notes – 4. Geometric Objects, Transformations and Hierarchies1 4. Geometric Objects, Transformations and Hierarchies Basic 3D...
Author: Bernard Hunt
2 downloads 3 Views 88KB Size
Jorg’s Graphics Lecture Notes – 4. Geometric Objects, Transformations and Hierarchies1

4. Geometric Objects, Transformations and Hierarchies Basic 3D objects • 5 Platonic solids what are good positions for the vertices? • Torus and sphere • quadrics = zero set of polynomial of degree 2 in 3 variables

Data Structures Objects are defined by Connectivity (”topology”) and Attributes(”geometry” = position, normal;also color etc). .off data format half-edge data structures

Vertex Arrays for polyhedral objects Reducing the number of function calls after glBegin(). Reducing the number of accesses to vertex coordinates. 1. enable: (initialize) glEnableClientState(GL COLOR ARRAY), glEnableClientState(GL VERTEX ARRAY) glEnableClientState(GL NORMAL ARRAY) 2. attach: (put data into the arrays) glVertexPointer (3, GL FLOAT, 0, vertices) (Color, Index, Normal, TexCoord,EdgeFlag) 3. render: (visit the array) single vertex: glArrayElement (5) list of vertices: glDrawElements(list) packed array: glInterleavedArrays() Example: cubeIndices = {5,4,. . . ,}, glDrawElements(GL QUADS, 24, GL UNSIGNED BYTE, cubeIndices) VBO(Vertex buffer object) provides regions of (graphics or un/cached system) memory (buffers) accessible through identifiers (binding).

Jorg’s Graphics Lecture Notes – 4. Geometric Objects, Transformations and Hierarchies2

Display lists separate display processor and memory == graphics server retained-mode graphics: (vs immediate-mode) – database of objects, – faster redisplay – slower the first display (overhead) glCallList(BOX) – subject to system state (model-view, projection) glGenLists – returns first unused label glCallLists – executes multiple display lists glCallLists( (GLint) strlen(text string), GL BYTE, text string);

(a)

Input Output 30º

(b)

base = glGenLists(256); // a character set of size 256 for (i=0; i

Suggest Documents