GLUT and GLVU Andy Wilson September 22 1999
GLUT and GLVU Andy Wilson September 22, 1999 Andy Wilson - GLUT and GLVU - 9/99 - Slide 1
Outline • Introduction • GLUT • GLVU • Where to learn more • Questions and Answers Andy Wilson - GLUT and GLVU - 9/99 - Slide 2
Introduction: Motivation • So you want to use Open. GL? – Low-level commands » Manage rendering state » Render primitives • The windowing system is in your way • No “world management” available Andy Wilson - GLUT and GLVU - 9/99 - Slide 3
Introduction: GLUT • GLUT: simple interface to window system – User functions handle window events » mouse, keyboard, resize, expose… – Simple pop-up menus – A few simple shapes (sphere, cone, teapot) • No concept of world or camera management – You reinvent the wheel a lot. Andy Wilson - GLUT and GLVU - 9/99 - Slide 4
Introduction: GLVU • GLVU: object and camera management – Several different model formats – Renderable objects – Easily extensible » Several modules available or under development IBR, tracking, large models, LOD. . . Andy Wilson - GLUT and GLVU - 9/99 - Slide 5
Outline • Introduction • GLUT • GLVU • Where to learn more • Questions and Answers Andy Wilson - GLUT and GLVU - 9/99 - Slide 6
GLUT: System Overview User Callbacks (Display, Idle, Keyboard, Mouse, Resize, …) GLUT Window System Events (Mouse, Keyboard, Window Expose/Hide/Resize/Destroy) Andy Wilson - GLUT and GLVU - 9/99 - Slide 7
GLUT: Program Structure • Initialization and window/menu setup • Interface callbacks – Handle mouse, keyboard input • Display function – Draw world (including camera management) • Idle function – Runs when no events pending Andy Wilson - GLUT and GLVU - 9/99 - Slide 8
GLUT: Interface Callbacks • Keyboard – Key press, key release, window location • Mouse – Enter/leave window, button down/up, drag • Menu – Item select Andy Wilson - GLUT and GLVU - 9/99 - Slide 9
GLUT: Display Callback • Responsible for entire display process – Clear buffers – Set up camera, GL matrix stacks – Draw objects (including multipass rendering) – Swap front/back buffer • Good place to put per-frame world updates – physics, collision, trackers Andy Wilson - GLUT and GLVU - 9/99 - Slide 10
GLUT: Idle Callback • Invoked when events not being received from window system • Typical uses: – request redraw (continuous update) – update simulation clock • No guarantee on when it’ll be called! Andy Wilson - GLUT and GLVU - 9/99 - Slide 11
What GLUT Doesn’t Do • World and model management – Load and place and render models yourself • Camera management – Manage GL projection stack yourself • Motion control – Arcball? Drive? Strafe? Look around? • Multipipe anything Andy Wilson - GLUT and GLVU - 9/99 - Slide 12
Outline • Introduction • GLUT • GLVU • Where to learn more • Questions and Answers Andy Wilson - GLUT and GLVU - 9/99 - Slide 13
GLVU: Overview • Object management – Several polygonal file formats supported – Objects can render themselves • Camera and simple navigation – Walk, translate, examine, look around • Easily extensible • Sits on top of GLUT Andy Wilson - GLUT and GLVU - 9/99 - Slide 14
GLVU: System Diagram GLVU Model Formats User Input Handlers GLVU Input Handlers User Idle Func GLUT Andy Wilson - GLUT and GLVU - 9/99 - Slide 15 User Display Func
GLVU: System Architecture • Everything is object-oriented C++ • Components all inherit from base classes – Camera, Object • Default GLUT keyboard and mouse handlers provided – User typically extends rather than replaces • GLVU divided into Core and Modules Andy Wilson - GLUT and GLVU - 9/99 - Slide 16
GLVU: Writing a Program • Just like writing a GLUT program, except… – Load models by instantiating objects – Call Display() methods instead of rendering by hand – Motion handlers already provided Andy Wilson - GLUT and GLVU - 9/99 - Slide 17
GLVU Core • Perspective Camera • VRML, BFF, OBJ, TRI, WFF model formats • Bounding boxes • PPM images (for texture maps) • Vector, Matrix math library • Walk, Examine, Look, Translate movement modes Andy Wilson - GLUT and GLVU - 9/99 - Slide 18
GLVU Modules • IBR far-field representations – Textured depth mesh, environment-mapped cubes, layered depth images, … • Light Cameras (place lights by moving viewpoint) • Large Model utilities (cells, memory management) • See Bill Baxter (baxter@cs) for latest list and owners Andy Wilson - GLUT and GLVU - 9/99 - Slide 19
Extending GLVU • New model formats – Just write a loader and a display method • Image-based rendering – Most work goes into display method – Almost anything can be cast as an Object • Can always override default GLVU input handlers – Trackers, button boxes, joysticks. . . Andy Wilson - GLUT and GLVU - 9/99 - Slide 20
User Interface Toolkits • Many available; choose your favorite • TCL/Tk – http: //dev. scriptics. com • GLUI – http: //www. cs. unc. edu/~rademach/glui • FLTK – http: //www. fltk. org Andy Wilson - GLUT and GLVU - 9/99 - Slide 21
Outline • Introduction • GLUT • GLVU • Where to learn more • Questions and Answers Andy Wilson - GLUT and GLVU - 9/99 - Slide 22
Where to Learn More • Read the example code! • GLUT – http: //reality. sgi. com/mjk_asd/glut 3. html • GLVU – Bill Baxter (baxter@cs) can tell you how to get the source Andy Wilson - GLUT and GLVU - 9/99 - Slide 23
Outline • Introduction • GLUT • GLVU • Where to learn more • Questions and Answers Andy Wilson - GLUT and GLVU - 9/99 - Slide 24
- Slides: 24