CSE528 Computer Graphics: Theory, Algorithms, and Applications

Similar documents
Computer Graphics. Chapter 3 Computer Graphics Software

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

Programming with OpenGL Part 1: Background

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Lecture 2 2D transformations Introduction to OpenGL

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics (Basic OpenGL)

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Graphics Programming

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

Exercise 1 Introduction to OpenGL

Rendering. Part 1 An introduction to OpenGL

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

Classic Rendering Pipeline

CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013

CS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II. Emmanuel Agu

Drawing Primitives. OpenGL basics

VR-programming tools (procedural) More VRML later in this course! (declarative)

Building Models. Objectives. Introduce simple data structures for building polygonal models. OpenGL vertex arrays. Vertex lists Edge lists

CS193E Lecture 17. Multiple Document Windows OpenGL & Cocoa

Lectures OpenGL Introduction

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

Introduction to OpenGL Week 1

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics and Visualization. Graphics Systems and Models

OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

CS 4204 Computer Graphics

Building Models. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Lecture 4 of 41. Lab 1a: OpenGL Basics

Basic Graphics Programming

Computer Graphics, Chapt 08

CS Computer Graphics: OpenGL, Continued

CS Computer Graphics: OpenGL, Continued

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

OpenGL Introduction Computer Graphics and Visualization

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

CIS 441/541: Introduction to Computer Graphics Lecture 14: OpenGL Basics

Introduction to OpenGL. CSCI 4229/5229 Computer Graphics Fall 2012

1.2 Basic Graphics Programming

CSE4030 Introduction to Computer Graphics

OpenGL. 1 OpenGL OpenGL 1.2 3D. (euske) 1. Client-Server Model OpenGL

Programming of Graphics

Lecture 2 5 Aug 2004

Computer Graphics Course 2005

Computer Graphics. OpenGL

Screen Space & World Space

GEOMETRIC OBJECTS AND TRANSFORMATIONS I

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

COMP 371/4 Computer Graphics Week 1

CS 591B Lecture 9: The OpenGL Rendering Pipeline

Display Lists. Conceptually similar to a graphics file. In client-server environment, display list is placed on server

Programming with OpenGL Part 1: Background

Models and Architectures

Introduction to OpenGL

4: Polygons and pixels

Fundamentals of Computer Graphics. Lecture 3 Generate a simple shape using OpenGL. Yong-Jin Liu

Introduction to Shaders.

CSC 8470 Computer Graphics. What is Computer Graphics?

Graphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Basic Graphics Programming

This library uses only GL functions but contains code for creating common objects and simplifying viewing.

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

cs123 Lab 3 OpenGL Part One 1 Introduction 2 OpenGL Basics 2.2 The Rendering Pipeline 2.1 The CPU and the GPU 2.3 Basic Syntax of OpenGL commands

How shapes are represented in 3D Graphics. Aims and objectives By the end of the lecture you will be able to describe

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)

Computer Graphics 1 Computer Graphics 1

World Coordinate System

Normalized Device Coordinate System (NDC) World Coordinate System. Example Coordinate Systems. Device Coordinate System

GLUT. What is OpenGL? Introduction to OpenGL and GLUT

RECITATION - 1. Ceng477 Fall

A display list is a group of OpenGL commands that have been stored for later execution.

Introduction to OpenGL

Computer Graphics - Chapter 1 Graphics Systems and Models

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

Introduction to Computer Graphics with WebGL

Computer graphic -- Programming with OpenGL I

Introduction to OpenGL

COMP3421 Computer Graphics

CS380: Computer Graphics Screen Space & World Space. Sung-Eui Yoon ( 윤성의 ) Course URL:

Image Processing. Geometry Processing. Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Display

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

Building Models. Objectives Introduce simple data structures for building polygonal models. Vertex lists Edge lists

UNIT 4 GEOMETRIC OBJECTS AND TRANSFORMATIONS-1

Programming using OpenGL: A first Introduction

The Rendering Pipeline (1)

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Introduction to Computer Graphics with OpenGL/GLUT

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

Transcription:

CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334 qin@cs.sunysb.edu http://www.cs.sunysb.edu/~qin CSE528 Lectures

Computer Graphics (Realistic) pictorial synthesis of real and/or imaginary objects from their computer-based models (datasets) It typically includes modeling, rendering (graphics pipeline), and human-computer interaction So, we are focusing on computer graphics hardware, software, and mathematical foundations Computer Graphics is computation A new method of visual computing Why is Computer Graphics useful and important? Course challenges: more mathematics oriented, programming requirements, application-driven, interdisciplinary in nature, etc. CSE528 Lectures

Computer Graphics Systems Graphical Models Rendering Parameters Rendering Output Device CSE528 Lectures

Output Devices Vector Devices Lasers (for example) Raster Devices CRT, LCD, bitmaps, etc. Most output devices are 2D Can you name any 3D output devices? CSE528 Lectures

Graphical Models 2D and 3D objects Triangles, quadrilaterals, polygons Spheres, cones, boxes Surface characteristics Color, reaction to light Texture, material properties Composite objects Other objects and their relationships to each other Lighting, fog, etc. Much, much more CSE528 Lectures

Rendering Conversion of 3D model to 2D image Determine where the surfaces project to Determine what every screen pixel might see Determine the color of each surface CSE528 Lectures

Rendering Parameters Camera parameters Location Orientation Focal length CSE528 Lectures

2D Graphics vs. 3D Graphics 2D 3D X, Y - 2 dimensions only We won t spend time on 2D graphics in this course X, Y, and Z Space Rendering is typically the conversion of 3D to 2D CSE528 Lectures

3D Coordinate Systems Y X Z Right-Hand Coordinate System OpenGL uses this! CSE528 Lectures

Y Z X Left-Hand Coordinate System Direct3D uses this! CSE528 Lectures

How to Model/Render This?

Render/Display a Box in OpenGL We render the 6 faces as polygons Polygons are specified as a list of vertices Vertices are specified in counter-clockwise order looking at the surface of the face! H G D C E F A B

Visualizing in 3D H Y y=1.0 G Counter-clockwise D C 1.0 E F x=1.0 X A B z=1.0 Z

OpenGL Conventions C library All function names start with gl OpenGL is a retained mode graphics system It has a state glbegin(gl_polygon) puts us into a polygon rendering state

OpenGL Polygon Rendering GLdouble size = 1.0; glbegin(gl_polygon); // front face glvertex3d(0.0, 0.0, size); glvertex3d(size, 0.0, size); glvertex3d(size, size, size); glvertex3d(0.0, size, size); glend();

OpenGL Types Basic numeric types GLdouble = double GLfloat = float GLint = int GLshort = short Mostly, you ll use GLdouble and GLfloat

Defined glvertex3fv Prefix gl glu wgl agl Function Vertex Begin End Lighting # Parms 1 2 3 4 Type f (float) d (double) i (integer) b (byte) s (short) Suffix v (vector) Only if varying arguments

Function Suffixes Many functions have alternatives Alternatives are specified by the suffix glvertex2d 2 double parameters void glvertex2d(gldouble x, GLdouble y); glvertex3f 3 float parameters void glvertex3f(glfloat x, GLfloat y, GLfloat z); glvertex3fv void glvertex3fv(const GLfloat *v);

All of Them glvertex2d, glvertex2f, glvertex2i, glvertex2s, glvertex3d, glvertex3f, glvertex3i, glvertex3s, glvertex4d, glvertex4f, glvertex4i, glvertex4s, glvertex2dv, glvertex2fv, glvertex2iv, glvertex2sv, glvertex3dv, glvertex3fv, glvertex3iv, glvertex3sv, glvertex4dv, glvertex4fv, glvertex4iv, glvertex4sv

Vector Parameters GLdouble a[ ] = {0, 0, 1}; GLdouble b[ ] = {1, 0, 1}; GLdouble c[ ] = {1, 1, 1}; GLdouble d[ ] = {0, 1, 1}; H G glbegin(gl_polygon); glvertex3dv(a); // front face D C glvertex3dv(b); glvertex3dv(c); E F glvertex3dv(d); glend(); A B

Specify a Color (No Lighting) glcolor3f(red, green, blue); Most of the same suffixes apply GLdouble size = 1.0; glcolor3d(1.0, 0.0, 0.0); // red glbegin(gl_polygon); // front face glvertex3d(0.0, 0.0, size); glvertex3d(size, 0.0, size); glvertex3d(size, size, size); glvertex3d(size, 0.0, size); glend(); Colors range from 0 to 1

How to Model/Render This?

d 3.00 Top View c X 1.00 h g 1.00 1.00 1.00 1.00 3.00 e f 1.00 a b Z a Y e f b f g Y 1.00 i m Front View n j X Z n o Side View

d 3.00 Top View c X 1.00 h g 1.00 1.00 1.00 1.00 3.00 e f 1.00 a b Z a Y e f b f g Y 1.00 i m Front View n j X Z n Side View o

Labels d Top View c l Bottom labels k h g p o e f m n a b i j a e f b f g i m Front View n j n Side View o

CSE528 Lectures

The Basic Idea Describe an object using surfaces Surfaces are polygons Triangles, quadrilaterals, whatever Important thing is that they are flat They must also be convex Provide points in counter-clockwise order From the visible side