Lecture 7 2D viewing 1 Lecture 7. 2D Viewing 2D viewing pipeline Clipping window, Normalization viewport transformation OpenGL 2D viewing functions Setup.

Slides:



Advertisements
Similar presentations
มุมมองใน 2 มิติ (2-D Viewing)
Advertisements

Okay, you have learned … OpenGL drawing Viewport and World Window setup main() { glViewport(0,0,300,200); glMatrixMode(GL_PROJECTION); glLoadIndentity();
Computer Graphics CLIPPING.
Objectives Define Clipping Various clipping methods. Line clipping methods.
Java ThreadsGraphics Programming Graphics Programming: Windows, Viewports & Clipping.
OPENGL.
Okay, you have learned … OpenGL drawing Viewport and World Window setup main() { glViewport(0,0,300,200); glMatrixMode(GL_PROJECTION); glLoadIndentity();
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:
Two-Dimensional Viewing Jehee Lee Seoul National University.
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
2D Viewing and Projection
2 D viewing Prepared by Elizabeth Isaac DCS, RSET.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
CHAPTER 7 2D VIEWING CGMB214: Introduction to Computer Graphics.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Two Dimensional Viewing Dr. Eng. Farag Elnagahy
2D Viewing. 2D viewing transformation is a mapping of world coordinate scene to device coordinates xw min xw max yw min yw max xv min xv max yv min yv.
UBI 516 Advanced Computer Graphics Two Dimensional Viewing ( Chapter 6 ) Aydın Öztürk Two Dimensional.
1 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
1 CMT Fundamentals of Computer Graphics Revision Dr. Xiaohong Gao BG---Room 2C23 Week 11.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
Two-Dimensional Viewing
Advanced Computer Graphics Three Dimensional Viewing
Clipping: Clipping is a process of dividing an object into visible and invisible positions and displaying the visible portion and discarding the invisible.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
3D Viewing.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
OpenGL Geometric Transformations. glMatrixMode(GL_MODELVIEW);
2 DIMENSIONAL VIEWING Ceng 477 Introduction to Computer Graphics Fall Computer Engineering METU.
TWO-DIMENSIONAL VIEWING
Geometric Transformations
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 1 1.
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.
Draw a Simple Object. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture blending.
EEL Introduction to Computer Graphics
Three-Dimensional Viewing Hearn & Baker Chapter 7
Chun-Yuan Lin Introduction to OpenGL 2015/12/19 1 CG.
CS552: Computer Graphics Lecture 6: Viewing in 2D.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
2D Viewing.
A.Aruna/Assistant Professor/SNSCE
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
Chapter: Viewing.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
3 DIMENSIONAL VIEWING Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Clipping.
Two-Dimensional Viewing Hearn & Baker Chapter 6
Three Dimensional Viewing
Computer Graphic 2 D Viewing.
Computer Graphics CC416 Week 14 3D Graphics.
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
Two-Dimensional Viewing
2D Viewing & Clipping 한신대 류승택
2D Viewing Pipeline.
Lecture 18 Fasih ur Rehman
WINDOWING AND CLIPPING
OpenGL 2D Viewing Pipeline
o عَلَّمَهُ الْبَيَانَ
WINDOWING AND CLIPPING
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
CSE 411 Computer Graphics Lecture #8 2D Viewing
Viewing/Projections I Week 3, Fri Jan 25
3D Viewing.
Presentation transcript:

Lecture 7 2D viewing 1 Lecture 7. 2D Viewing 2D viewing pipeline Clipping window, Normalization viewport transformation OpenGL 2D viewing functions Setup clipping window, viewport Display window managing Clipping algorithms –TWO-DIMENSIONAL POINT CLIPPING –LINE CLIPPING (1) Cohen-Sutherland Line Clipping (2) Liang-Barsky Line Clipping (3) Nicholl-Lee-Nicholl Line Cliping

Lecture 7 2D viewing 2 2D viewing pipeline Transformation vertices from MC to DC in five stages Construct WC scene using MC transformation Convert WC to VC Transform VC to NC Map NC to DC MC WCVCNCDC Clipping window (world window, or viewing window) The section of 2D scene selected for display Display window Viewport

Lecture 7 2D viewing 3

4

5

6

7 2D viewing pipeline transformations Construct WC scene using MC transformation Convert WC to VC Transform VC to NC Map NC to DC MC WCVCNCDC MC VC NC DC MC WC VC

Lecture 7 2D viewing 8 OpenGL 2D viewing functions OpenGL has no specific functions for 2D viewing. 2D viewing is a special case of 3D viewing glMatrixMode(GL-PROJECTION) Designate the projection matrix as the current matrix. Which is originally the identity matrix. Set the current matrix as identity matrix glLoadIdentity(); GLU clipping window function gluOrtho2D(xwmin, xwmax, ywmin, ywmax); OpenGL viewport function glViewport(xvmin, yvmin, vpWidth, vpHeight);

Lecture 7 2D viewing 9 GLUT display window functions Set Color mode, buffer mode glutInitDispalyMode(GLUT_SINGLE | GLUT_RGB); glClearColor(red, green, blue, alpha); glClearIndex(index); Display-window identifier glutSetWindow(windowID); currentWindowID = glutGetWindow(); Deleting a GLUT display window glutDestroyWindow(windowID); Relocate and resize glutPositionWindow(x, y); glutReshapeWindow(newWidth, newHeight); Display window relocate, and resize glutFullScreen(); glutReshapeFunc(winreshapFcn);

Lecture 7 2D viewing 10 Managing multiple GLUT display windows glutIconifyWindow(); glutSetIconTitle(“Icon Name”); glutSetWindowTitle(“New window name”); glutPopWindow(); glutPushWindow(); glutHideWindow(); glutShowWindow(); glutCreateSubWindow(……)

Lecture 7 2D viewing 11 Clipping algorithms Clipping: Generally, any procedure that identifies those portions of a picture that are either inside or outside of a specified region of space is referred as a clipping algorithm, or simply clipping. Types of Clipping: –Point clipping –Line Clipping (straight-lines Segments) –Area Clipping (Polygons, Curve-boundary Areas) –Curve Clipping –Text Clipping

Lecture 7 2D viewing 12 Point clipping Given a point P=(x, y), we display the point if the following inequalities are satisfied: xwmin <= x <= xwmax ywmin <= y <= ywmax where (xwmin, xwmax, ywmin, ywmax ) defines the clipping window position in WC or SC.

Lecture 7 2D viewing 13 Line Clipping Possible relationships between line positions and a clipping rectangle: 1.Totally out 2.Totally in 3.in-and-out 4.out-in-out

Lecture 7 2D viewing 14

Lecture 7 2D viewing 15

Lecture 7 2D viewing 16

Lecture 7 2D viewing 17

Lecture 7 2D viewing 18

Lecture 7 2D viewing 19

Lecture 7 2D viewing 20

Lecture 7 2D viewing 21

Lecture 7 2D viewing 22

Lecture 7 2D viewing 23

Lecture 7 2D viewing 24

Lecture 7 2D viewing 25

Lecture 7 2D viewing 26

Lecture 7 2D viewing 27

Lecture 7 2D viewing 28

Lecture 7 2D viewing 29

Lecture 7 2D viewing 30

Lecture 7 2D viewing 31

Lecture 7 2D viewing 32