110 likes | 270 Vues
Object Oriented Design. Goals. Using OpenGL as case study turning a blob anti pattern into an Object-Oriented Architecture A Quick Introduction to OpenGL Provide pointers to resources. Why OpenGL?. Serves as great design case to explore a variety of OOD issues.
E N D
Goals • Using OpenGL as case study turning a blob anti pattern into an Object-Oriented Architecture • A Quick Introduction to OpenGL • Provide pointers to resources
Why OpenGL? • Serves as great design case to explore a variety of OOD issues. • Extremely useful to build 2D/3D games • Provides access to sophisticated graphics supported by hardware acceleration • E.g., ATI Radeon, GeForce • Results in complex but efficient rendering • Already these cards can draw a multi thousands 3D polygon object with light sources, etc. faster than a 32 x 32 pixel desktop icon.
OpenGL Architecture http://developer.apple.com/techpubs/macosx/Carbon/graphics/OpenGL/OpenGL/chap2/index.html
Anti Patterns: OpenGL the Mega Blob • “a class with 60 or more attributes and operations usually indicates the presence of the Blob” • OpenGL >= 300 http://gl4java.sourceforge.net/docs/html/ • What can we do make this enormous functionality more accessible through OOD?
Let’s make a Game Engine • Refactoring • Bottom up: to make OpenGL functionality available • Top down: to capture needs by a variety of games • We use some ideas from our 2D editor design Game 1 Game 2 Game n Game Engine Chris Schenk & Luke Swanson OpenGL Hardware
Examples • Create a subclass of the OpenGLWindow class and extend the display, reshape, idle and init methods. • OpenGL for MCL • Triangles, cubes, sprites, textures • OpenGL for Java
Trade offs • This is not an OpenGL course • Keep OpenGL specific lectures to a minimum • Read the books for more depth • Game Engine will have to be very simple stressing simplicity over depth and performance
OpenGL Resources • The OpenGL Red Book • The must have Programming Guide • http://fly.cc.fer.hr/~unreal/theredbook/ • The OpenGL Blue Book • The Reference Manual • http://www.eecs.tulane.edu/www/graphics/doc/OpenGL-Man-Pages/opengl_index_spec.html • Real-Time Rendering • A truly wonderful book covering a lot of ground on how to make efficient 3D • http://www.amazon.com/exec/obidos/ASIN/1568811012 • http://www.opengl.org/
Homework • Download and install GL4Java • http://www.jausoft.com/gl4java.html • After installation run the demos • Due: October 31 • Read OpenGL Red book chapter 1 and 2 • http://fly.cc.fer.hr/~unreal/theredbook/ • Due: November 5