Presentation is loading. Please wait.

Presentation is loading. Please wait.

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Goals Give student some idea.

Similar presentations


Presentation on theme: "Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Goals Give student some idea."— Presentation transcript:

1 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Goals Give student some idea what this class is about Start Event Driven Programming if possible

2 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 What is this class about Building interactive graphics applications Ask: "What is interactive"? real time "What is graphics"? visualization of geometry human as IO device

3 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 What is non-interactive application? Show ray tracer and output BumpScene/color.jpg - the color file BumpScene/CommandFile.Bump - to bump the file BumpScene/BumpImage.Color.jpg - color rendered image BumpScene/BumpImage.BumpOut.jpg - bumped file sacrifice time for quality (always true) animated movies are not done with "real time interactive"

4 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Results: Demo Demo a couple of previous year's project FORMS! need to sign form to have projects posted. major difference with simple games: we do LOTS of unnecessary work!!. e.g., transformation multiple views real collision proper software architectural structure Our projects also lack in fun!

5 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Results: Expectations Past good students get job at games company: Peter Yiap: Big fish Robert Stone: Amaze entertainment This is A LOT of work! Make sure you understand each assignment! the assignments build on each other) Large source code it helps if you like programming!

6 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Our approach: Learn concepts (transformation) See how implemented (Tutorial 9.x) You: Use the implementation in more complex applications Implement some of the concepts not shown in tutorials

7 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Language and API Language: C++ You can use C# (XNA) Java (require more work): trick is lanauge, GUI and Graphics API are tightly related. GUI API: MFC WinForm (for C#), WTL (C++), GLUT/FLTK (OpenGL) Swing (Java) Graphics API: Direct3D and OpenGL You can use Java3D (only with Java) XNA Framework (only with C#)

8 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Tutorials: Start simple (few files) builds up over the quarter (100+ files) Most of the code will be provided to you In the forms of software library: Libraries: versions 1 to 12 Organizations: Chapter_xx/Tutorial_xx.y_OnPageZZZ/C++_D3D_MFC In C++ and D3D and MFC Chapter_xx/Tutorial_xx.y_OnPageZZZ/C++_OGL_MFC In C++ and OGL and MFC In the future: C# and WinForm and XNA Framework

9 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Provided source code: You NEED to understand the implementation of the source code provided to you! If your program does not work because of the library: it is your fault! Source is provide for you, you should fix the problem!

10 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Library: naming UWBGL_D3D_Lib1 to UWBGL_D3D_Lib12 File names: All names begin with uwbgl_D3D E.g.: uwbgl_D3DCircleGeom.h, we often refer to the file simply as “CircleGeom.h” All names end with a version number E.g.: uwbgl_D3DCircleGeom2.h: second version of the file File version number is independent from library veriosn number. E.g., since the file uwbgl_D3DGraphicsSystem1.h did not change, is belongs to UWBGL_D3D_LIB2 Replace D3D by OGL/XNA/MFC for different API types

11 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Learning from source code: User of source code Learn how to build applications by calling the provided functions Evaluator of the source code Use the provided source code, and Evaluate: what is good, why is it bad Developer of your own system Use the provided source as an example prototype Develop your own supporting library MOST REWARDING! Time demanding!

12 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Let begin! Ball shooting program (Tutorial 6.6) Ask ourselves, what are needed to implement this program?

13 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Control driven programs

14 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 More detailed parsing …

15 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Concerns Complexity of our code Number of events! Un-handled events! (expose, iconize, …) Efficiency constantly waiting for the user Repeating of similar work across applications (e.g., iconize)

16 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event driven programming No notion of main() function! Instead: have a MainEventLoop() function …

17 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Main Event Loop

18 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Interesting differences MainEventLoop() is not ours! We as programmer, we cannot change this function!! Instead, we have to program _with_ this function! What happens at Label A? and How to define “service routine”? Interesting points: Label B: loop forever!! When will your program ever quit? Label C: wait (instead of busy loop) Label D: every event has a default action

19 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event Driven Program

20 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Pseudo Code …

21 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event Program structure Application State Well defined Persist over function calls Service of Events To change the application state Optional: kind of nice to have displaying of application state

22 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event: Origin and Handling Operating System and Window Manager Windows (Integrated system) Unix + X Windows with twm, mwm, etc. GUI API Graphical User Interface Application Programming Interface Define GUI Element for handling events

23 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 GUI Elements: Virtual/Abstract IO devices Windows, Buttons, Slider bars, etc. Associated with each GUI element, there are a set of defined events: E.g., Button: click, release, double click, etc. E.g., Window: mouse over, mouse move, etc. As programmer, we can: Ignore events from a GUI element or Service events from a GUI element

24 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Events:Categories User: generated events Application specific: LMB click/drag We should service this General: iconize Window manager will service this Application generated events Timer: we should service this External: GUI state change: E.g., SystemInitialization() Select interested ones to service Window Environment: E.g., Exposure Select interested ones to service Request Collaboration: E.g., Redraw events Must service!

25 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event Service registration Subclass override methods (A) Call back function registration (D1)

26 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event Service Routines Service one state and return Stateless!! Should not contain presistent variables Verify invocation conditions Error checking Our tutorials has serious problem with lack of error checking!!

27 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event Service: Ball Shoot Application state + Registration

28 Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Event service: Ball shoot


Download ppt "Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Intro and Chapter 1 Goals Give student some idea."

Similar presentations


Ads by Google