Object Oriented Design. Goals  Bottom Up Design: refactoring fundamental OpenGL functionality  Game Engine 1.0 introduction.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
The View Frustum and the Camera Lecture 19 Fri, Oct 10, 2003.
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
OpenGL Basics Donghui Han. Assignment Grading Visual Studio Glut Files of four types needed: – Source code:.cpp,.h – Executable file:.exe (build in release.
Based on slides created by Edward Angel
Viewing and Transformation
Viewing and Projections
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
Object Oriented Design. Announcement Andri got her PhD! congratulations.
OpenGL and Projections
Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.
Object Oriented Design. Goals  Using OpenGL as case study turning a blob anti pattern into an Object-Oriented Architecture  A Quick Introduction to.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Computer Graphics (Fall 2008) COMS 4160, Lecture 4: Transformations 2
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Object Oriented Design. Goals  Examples of GL4Java: what can be done with OpenGL?  Forming groups: u Outline project u Formulate requirement for Game.
Object Oriented Design. Goals  Feedback on The Sims  How to make an object  Working on Final Project.
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
Development of Interactive 3D Virtual World Applications
Introduction to 3D viewing 3D is just like taking a photograph!
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
UniS CS293 Graphics with Java and OpenGL Textures.
Advanced Computer Graphics Three Dimensional Viewing
Week 2 - Wednesday CS361.
Geometric transformations The Pipeline
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL and Parametric Curves Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2005/12/21 with slides by Brian Curless, Zoran Popovic, Robin.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 4: Transformations 2
Lecture 11: Exam Revision 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271  Coursework.
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Computer Viewing.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
CGGM Lab. Tan-Chi Ho 2001 Viewing and Transformation.
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
Chap 3 Viewing and Transformation
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
Overview  Basic requirements of implementation  Image resource  Texture mapping  Advanced requirements of implementation  KGL sprite class.
CS 4731: Computer Graphics Lecture 12: More 3D Viewing Emmanuel Agu.
CS559: Computer Graphics Lecture 12: OpenGL - Transformation Li Zhang Spring 2008.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
OpenGL LAB III.
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
What you will learn about today
Projection v VP u VPN n.
CS451Real-time Rendering Pipeline
What you will learn about today
Type of View Perspective View COP(Center of Plane) Diminution of size
University of New Mexico
Computer Graphics 3Practical Lesson
Chapter 3 Viewing.
Projection v VP u VPN n.
CS297 Graphics with Java and OpenGL
Presentation transcript:

Object Oriented Design

Goals  Bottom Up Design: refactoring fundamental OpenGL functionality  Game Engine 1.0 introduction

Top Down Requirement Analysis (repeat)  Collect what the different applications/games need to have from the Game Engine  Danger: u Getting carried away: create laundry list of features u Creating specification that cannot be implemented (in time, within budget, …)

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: u Feature oriented: contrast between cool and necessary functions

General Architecture OpenGL ® Game Contra application middle ware API hardware

Refactoring textured square example  Basic structure of OpenGL application is given by init, display, and reshape  Look for code that, in generalized form can be moved from application into middleware layer  => 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 u preDisplay:  low level initializations that most applications would need anyway, e.g, clearing buffer.  Translating, rotating individual objects u mainDisplay: leave this to application to specialize u 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)  => useTexture (“image.png”) u Load texture file if necessary (implement cache)  Assume file is contained in data/ folder relative to codeBase() u Bind texture u Manage name space

Produce new application with middleware stuff removed

Fat free application package contra; import gl4java.*; import gl4java.utils.textures.*; import java.io.*; public class textureGLWindow extends GLWindowApplet { public void mainDisplay() { useTexture ("borg2.png"); gl.glBegin(GL_POLYGON); gl.glTexCoord2f( 1f, 1f); gl.glVertex3f( 1f, 1f, 0f); gl.glTexCoord2f( 1f, -1f); gl.glVertex3f( 1f, -1f, 0f); gl.glTexCoord2f(-1f, -1f); gl.glVertex3f(-1f, -1f, 0f); gl.glTexCoord2f(-1f, 1f); gl.glVertex3f(-1f, 1f, 0f); gl.glEnd(); }

About texture files  Size: 2 n x 2 m u Size cannot be arbitrary u Example  valid: 64 x 512  invalid: 150 x 248  File type u Support only.png u 24 bit: RGB u 32 bit RGBA includes 8 bit transparency

Game engine 1.0  GLWindow u Contains scene u Manages resources, e.g. textures  Camera u Control camera parameters  Agent u Scene content

ContraCanvas Agents: List of Agent Textures: Hashtable of Name  Id Camera: Camera init() display() useTexture(Name: String) reshape(Height: Integer, Width: Integer)

Camera For details see Red Book chapter 3 Camera View: GLWindow eye-x, eye-y, eye-z: Float center-x, center-y, center-z: Float up-x, up-y, up-z: Float Fovy: Float Aspect: Float Near: Float Far: Float aimCamera(eye-x, eye-y, eye-z, center-x, center-y, center-z, up-x, up-y, up-z, Fovy, Aspect, Near, Far: Float)

Agent View: GLWindow Name: String x, y, z: Float x-turn, y-turn, z-turn: Float Roll, Pitch, Heading: Float Agents: List of Agent Display()

Euler Angles head roll pitch

Relative coordinate systems  Example: art dummy  With nested objects/agents coordinate systems should be relative  Rotations need to be nested as well

Homework  PROJECT: u Make one object  Use Game engine code:  Each team member could make different object part of final project  Apply Textures u TEST applet (local and over network) u URL to Alex & Andri u Due: November 19  READING: u OpenGL Red book chapter 9: Texture Mapping u u Due: November 19