Presentation is loading. Please wait.

Presentation is loading. Please wait.

School of Computer Science

Similar presentations


Presentation on theme: "School of Computer Science"— Presentation transcript:

1 School of Computer Science
Computer Graphics School of Computer Science University of Seoul Minho Kim

2 To Get Started... What we need? To create a window To handle events
To render objects OpenGL only supports “rendering” process Helper library required → GLUT (GL Utility Toolkit)

3 sample01.c Minimal OpenGL program How can we compile it?
What each function call does? What happens if we remove each function call? What is the relationship between the coordinates of the vertices and the screen? How can we change the initial window size/position? How can we change the color used to clear the screen? How can we change the color of the rectangle? How can we draw other primitives?

4 More on OpenGL/GLUT Naming conventions Data types
What are the buffers other than color buffer? How many states are there? Which objects can we draw? What other events can we handle?

5 sample02.c What do we need to do for “double buffering”?
How can we handle the keyboard event? How can we handle other key events, such as function keys and arrow keys? How can we handle modifier keys? How can we change the mapping between the coordinate system and the screen? How can we remove the distortion?

6 sample03.c To change the (orthographic 2D) camera setting dynamically – translation & zooming How can we rotate the camera? What types of cameras are supported? What is the default camera setting? What does the projection matrix do? How can we make the image flipped vertically/horizontally? How can we achieve the same effect using glMultMatrix?

7 Matrix Stacks The top element denotes current matrix state
Four stacks: modelview, projection, texture, and color Different (minimum) stack depth for each Stored in column-major format Operations glLoadIdentity, glLoadMatrix, glPushMatrix, glPopMatrix, glMultMatrix, etc. Can handle hierarchical transformation (modelview) – How?

8 sample04.c Transformation using modelview matrix stack
What's the content of the modelview matrix stack? How can we implement scissor-type “hand”?

9 sample05.c Perspective projection glFrustum How can we zoom in/out?
How can we achieve the same projection using glMultMatrix?

10 Hidden-Surface Removal
OpenGL uses z-buffering (depth-buffering) To-do: Request depth buffer (glutInitDisplayMode) Enable depth test (glEnable(GL_DEPTH_TEST)) Clear depth buffer before rendering (glClear)


Download ppt "School of Computer Science"

Similar presentations


Ads by Google