240 likes | 481 Views
GLUT and GLVU. Andy Wilson September 22, 1999. Introduction GLUT GLVU Where to learn more Questions and Answers. Outline. So you want to use OpenGL? Low-level commands Manage rendering state Render primitives The windowing system is in your way No “world management” available.
E N D
GLUT and GLVU Andy Wilson September 22, 1999
Introduction GLUT GLVU Where to learn more Questions and Answers Outline
So you want to use OpenGL? Low-level commands Manage rendering state Render primitives The windowing system is in your way No “world management” available Introduction: Motivation
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. Introduction: GLUT
GLVU: object and camera management Several different model formats Renderable objects Easily extensible Several modules available or under development - IBR, tracking, large models, LOD... Introduction: GLVU
Introduction GLUT GLVU Where to learn more Questions and Answers Outline
GLUT: System Overview User Callbacks (Display, Idle, Keyboard, Mouse, Resize, …) GLUT Window System Events (Mouse, Keyboard, Window Expose/Hide/Resize/Destroy)
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 GLUT: Program Structure
Keyboard Key press, key release, window location Mouse Enter/leave window, button down/up, drag Menu Item select GLUT: Interface Callbacks
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 GLUT: Display 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! GLUT: Idle Callback
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 What GLUT Doesn’t Do
Introduction GLUT GLVU Where to learn more Questions and Answers Outline
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 GLVU: Overview
GLVU: System Diagram User Input Handlers GLVU Model Formats GLVU Input Handlers User Idle Func User Display Func GLUT
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 GLVU: System Architecture
Just like writing a GLUT program, except… Load models by instantiating objects Call Display() methods instead of rendering by hand Motion handlers already provided GLVU: Writing a Program
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 GLVU Core
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 GLVU Modules
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... Extending GLVU
Many available; choose your favorite TCL/Tk http://dev.scriptics.com GLUI http://www.cs.unc.edu/~rademach/glui FLTK http://www.fltk.org User Interface Toolkits
Introduction GLUT GLVU Where to learn more Questions and Answers Outline
Read the example code! GLUT http://reality.sgi.com/mjk_asd/glut3/glut3.html GLVU Bill Baxter (baxter@cs) can tell you how to get the source Where to Learn More
Introduction GLUT GLVU Where to learn more Questions and Answers Outline