Date post: | 21-Dec-2015 |
Category: |
Documents |
View: | 216 times |
Download: | 3 times |
Object Oriented Design
Goals
Feedback homework 8 Top Down Design: analyzing the requirements Bottom Up Design: refactoring fundamental
OpenGL functionality
The makings of the glutplane
Assumption: runtime environment is set up Windows: GL4Java*.dlls installed Mac: GL4Java*.zips installed in MRJClasses
Find file “glutplane.java” and “glutplane.html”
Install compile/link time environment Windows: add GL4Java.jar to classpath Mac: add GL4Java*.zips to project
Tools
Basic level tools Javac (part of Sun’s JDK) Jikes: http://www.research.ibm.com/jikes/
IDEs Jbuilder (Windows, OS X) CodeWarrior (Windows, OS X, OS 9, …)
Modify source
Edit “glutplane.java” Replace 3 calls to add_plane(); with 20 calls
Hint: use a “for” loop instead of typing add_plane(); 20 times! Compile/run/test Upload binary files (.class) and .html file to Web server
glutplane.class glutplane$planeobj.class glutplane$glutplaneCanvas.class
Test applet on server email URL referring to html file.
More information
Provided by the Game Engine builders http://schenkc.freeshell.org/classes/csci4448
/contra/installation.html
Chris Schenk: [email protected] Luke Swanson: [email protected]
Top Down Requirement Analysis
Collect what the different applications/games need to have from the Game Engine
Danger: Getting carried away Creating specification that cannot be
implemented (in time, within budget, …)
Requirement for Game engine
Camera aimed at character Multiple cameras
Shapes Aggregate shapes Rotation of shapes and camera Collision detection IIII Clipping Physics II
Particles Text Infinite backgrounds (repetitive textures, sky domes, …) Foreground/messages/score keeping
Camera Control
Multiple cameras Switching between cameras: no gui
Camera tracking (stay on object) zoom Multiple views at the same time Independent control of camera
Shapes
Box, sphere, circle, rectangle, plane, line, point, cylinder, triangle strip,
Single / aggregate shapes Rotation Move in scene Add textures to shape Loading models
Load .obj files
Collision Detection iii
Detect collision of shapes and groups of shapes
Approximation with spheres Cubes
Clipping
no
Physics
Particles Airplanes, skis, bikes Simple gravity (would be nice)
Text
no
Backgrounds
Flat but repetitive Sky domes, Sky boxes
Information panels
Score keeper Output message Dialogs (hard)
Use OpenGL, Swing or AWT? Menus (hard)
Use OpenGL, Swing or AWT?
Bottom Up system design
Refactor existing functionality (the OpenGL mega blob) into service classes
Approach: look at instances of applications containing functionality that could be factored out of the application into a the middle ware layer => the Game Engine
Danger: Feature oriented: contrast between cool and necessary
functions
Refactoring textured square example
Basic structure of OpenGL application is give by init, display, and reshape
Look for code that, in generalized form could be pushed into game engine
=> collect these operations and attributes in a class called glWindow
INIT
Collect a set of good initializations that make sense for most applications
Turn most features ON (lighting, texture mode)
In worst case application can overwrite or extend INIT
DISPLAY
Refactor display method into preDisplay:
low level initializations that most applications would need anyway, e.g, clearing buffer.
Translating, rotating individual objects
mainDisplay: leave this to application to specialize postDisplay:
Cleanup, error handling Buffer swapping (to implement double buffering)
Factor out utility functions
Example: texture manager Replace complex implementations of
texture loading with single calls of texture managing functions located in middle ware (game engine)
Produce new application with middleware stuff
removed
Homework PROJECT:
Finish game proposal document Email to Alex & Andri Due: November 12
READING: OpenGL Red book chapter 3; Viewing http://fly.cc.fer.hr/~unreal/theredbook/ Due: November 12