OpenGL Display Lists A way to improve performance.

Slides:



Advertisements
Similar presentations
Chapter 11. Faster Geometry Throughput Presented by Garrett Yeh.
Advertisements

1Introduction A display list is a group of OpenGL commands that have been stored for later execution. Most OpenGL commands can be either stored in a display.
Better Interactive Programs
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Graphics Pipeline.
OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Meshes Dr. Scott Schaefer. 3D Surfaces Vertex Table.
© Tamara Munzner University of British Columbia Hierarchical modelling recap: composing transforms recap: composing transforms finish: rendering pipeline.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Introduction to OpenGL Joseph Kider University of Pennsylvania CIS 565 – Fall 2011 (Source: Patrick Cozzi)
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
University of British Columbia CPSC 414 Computer Graphics Week 3, Monday 15 Oct 03 © Tamara Munzner 1 Hierarchies, Display Lists recap: matrix hierarchies,
SWE 423: Multimedia Systems Chapter 4: Graphics and Images.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
 Bitmap: A bitmap is a rectangular array of 0s and 1s that serves as a drawing mask for a corresponding rectangular portion of the window.  Applications:
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
Using OpenGL in Visual C++ Opengl32.dll and glu32.dll should be in the system folder Opengl32.dll and glu32.dll should be in the system folder Opengl32.lib.
Speeding Up Rendering After Deciding What to Draw.
Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
State Management and Drawing Geometry Objects
Computing & Information Sciences Kansas State University Lecture 20 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 21 of 42 William H. Hsu.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Review of OpenGL Basics
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Computer Graphics Bing-Yu Chen National Taiwan University.
MAE152 Computer Graphics for Scientists and Engineers Fall 03 Display Lists.
OpenGL Architecture Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Frame Buffer Texture.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
UniS CS297 Graphics with Java and OpenGL State Management and Drawing Primative Geometric Objects.
Input and Interaction Yuanfeng Zhou Shandong University Software College 1.
David Luebke1/5/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
OpenGL Graphics Textures. Quiz You didn't see that coming!
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Graphics Output Primitives
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
OpenGL Vertex Arrays OpenGL vertex arrays store vertex properties such as coordinates, normal vectors, color values and texture coordinates. These properties.
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Computer Graphics I, Fall 2010 Building Models.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 17 Animations, Loops.
OpenGL Objects Finalised. Debugging Tip For Debugging your applications remember: glGetError(); gluErrorString(); Don’t use these in release code (the.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CS 480/680 Computer Graphics Programming with Open GL Part 2: Complete Programs Dr. Frederick C Harris, Jr. Fall 2011.
Modeling Transformations
Computer Graphics and Visualization (06 CS 65)
Draw a Simple Object.
Better Interactive Programs
Advanced Graphics Algorithms Ying Zhu Georgia State University
Project 1: Into Space! CG Concepts Needed
Transformations IV Week 3, Wed Jan 20
Display Lists & Text Glenn G. Chappell
Better Interactive Programs
Orphan Object (Bill) Current texture object behavior:
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Transformations IV Week 3, Wed Jan 23
CS297 Graphics with Java and OpenGL
Presentation transcript:

OpenGL Display Lists A way to improve performance.

Why Use Display Lists May improve performance. You can define the geometry and/or state changes once and execute them multiple times. Download remotely to reduce network overhead. Even locally, you can reduce overhead by storing frequently used commands.

EXAMPLE Consider a Tricycle. Two same sized wheels. –Offset from one another. One larger wheel. –Also offset. Use ONE wheel description in a display list and execute the list three times.

OpenGL Code GLuint theTorus; theTorus = glGenLists(1); glNewList(theTorus, GL_COMPILE); torus(8,25); /* draw the torus */ glEndList();... (and in display function) glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(theTorus); glFlush();

OpenGL Code GLuint theTorus; theTorus = glGenLists(1); glNewList(theTorus, GL_COMPILE); torus(8,25); /* draw the torus */ glEndList();... (and in display function) glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(theTorus); glFlush();

OpenGL Code GLuint theTorus; theTorus = glGenLists(1); glNewList(theTorus, GL_COMPILE); torus(8,25); /* draw the torus */ glEndList();... (and in display function) glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(theTorus); glFlush();

OpenGL Code GLuint theTorus; theTorus = glGenLists(1); glNewList(theTorus, GL_COMPILE); torus(8,25); /* draw the torus */ glEndList();... (and in display function) glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(theTorus); glFlush();

OpenGL Code GLuint theTorus; theTorus = glGenLists(1); glNewList(theTorus, GL_COMPILE); torus(8,25); /* draw the torus */ glEndList();... (and in display function) glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glCallList(theTorus); glFlush();

Not Guaranteed Although you’re not guaranteed that your OpenGL implementation optimizes display lists for any particular uses, executing display lists is no slower than executing the commands contained within them individually. There is some overhead in jumping to a display list.

Optimization Possibilities Matrix Operations. Compute both the matrix and its inverse and store in a display list. Raster bitmaps and images. Transform the data into a representation preferred by the hardware and store in a display list. Lights, Material Properties, and Lighting Models. Put material definitions in a display list. Polygon stipple patterns.

Store State Settings with Geometry glNewList(1, GL_COMPILE); Draw_some_geometric_objects(); glEndList(); glLoadMatrix(M); glCallList(1); glNewList(1, GL_COMPILE); glLoadMatrix(M); Draw_some_geometric_objects(); glEndList()’ glCallList(1);

What’s Stored in a Display List Only the values for expressions. If values in an array are subsequently changed, the display list values DON’T change!

Cannot Be Stored glAreTexturesResident() glClientActiveTexture() glColorPointer() glDeleteLists() glDeleteTextures() glDisableClientState() glEdgeFlagPointer() glEnableClientState() glFeedbackBuffer() glFinish() glFlush() glFogCoordPointer() glGenLists() glGenTextures() glGet*() glIndexPointer() glInterleavedArrays() glIsEnabled() glIsList() glIsTexture() glNormalPointer() glPixelStore() glPopClientAttribute() glPushClientAttribute() glReadPixels() glRenderMode() glSecondaryColorPointer() glSelectBuffer() glTexCoordPointer() glVertexPointer()

Hierarchical Display Lists A list that executes another display list by calling glCallList() between a glNewList() and glEndList() pair. A default limit to the nesting level of 64. glGetIntegerv(GL_MAX_LIST_NESTING, GLint * data); (for your implementation)

Redbook Examples torus.c list.c stroke.c