Presentation on theme: "CSE 457 Modeler Help Session Lovingly brought to you by: TA Steve."— Presentation transcript:
CSE 457 Modeler Help Session Lovingly brought to you by: TA Steve
What I’ll be yappin’ about... Quick review of OpenGL Overview of the application What’s in the code? Building a model Hierarchies: Live and Uncut! Some Warnings A few Hints...
OpenGL Review Remember: OpenGL is a STATE MACHINE. –When you enable/disable something— glEnable/Disable()—you are changing state. –I.e... Change it once, and then change it to something different when necessary. How OpenGL draws:
Overview of the Application Two windows –Control Slider Window and Model View To control the model view... –Left-click Rotate the camera around the point that it is currently looking at. –Middle-click Move the point that the camera is currently looking at. –Right-click Move the camera closer to the point that it is currently looking at
What’s in the Code? modelerapp.* and modelerui.* –Handles most of the user interface stuff (sliders, windows, etc). –Modelerapp.h defines the ModelerApplication class, which is important modelerdraw.* –Primitive shapes (spheres, boxes, cylinders, and triangles) –Changing material attributes
What’s in the Code? (cont) modelerview.h defines the ModelerView object –This is the base class of your model. –Handles the OpenGL drawing and event handling. –Look at sample.cpp; notice that BoxModel is a subclass of ModelerView? camera.* –Provides camera functionality. –Modify this file to implement your own version of gluLookAt.
What’s in the Code? (cont) Vec/Mat.h –Some nice vector/matrix operations, already written for you! –Even after 3 years, may still have some bugs— out if you find one. modelerui.fl –Unless you have a great reason, don't touch this. Millions of innocents could suffer!
Building a Model Check out sample.cpp (might want to rename this) –This is where your model class is defined. The draw method of this class is where you will build your model. –Look in main() This is where the model controls are defined The global enum at the top of the file defines the name and number of controls.
Hierarchies gone Wild! (cont) How do we build an articulated model using hierarchies and OpenGL? Check out this example...
Some Warnings Don’t edit modelerdraw or modelerapp unless you really really have to! –Depending on your changes, editing these files may make your model incompatible with the animator skeleton code. –You should be able to do everything you need within the other files. Remember to keep track of your pushes and pops! –Mapping out your hierarchy on paper may not hurt either.
Some miscellaneous hints... gluLookAt –Check out your slides and the OpenGL blue book. –It is important that you understand how this works. How do I create animation...? –Figure out a good way to call draw() repeatedly. Online tutorials can be invaluable. –Use these to help with OpenGL implementation.