OpenGL. Toolkits.

Similar documents
Computer graphics MN1

Graphics Pipeline & APIs

Graphics Pipeline & APIs

Lecture 4 of 41. Lab 1a: OpenGL Basics

Computer graphics MN1

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3

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

Precept 2 Aleksey Boyko February 18, 2011

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

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

CSC 8470 Computer Graphics. What is Computer Graphics?

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

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

An Interactive Introduction to OpenGL Programming

Graphics Programming

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

Computer Graphics Programming

Basic Graphics Programming

Programming using OpenGL: A first Introduction

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

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

CS 591B Lecture 9: The OpenGL Rendering Pipeline

Introduction to OpenGL Week 1

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

CS 428: Fall Introduction to. OpenGL primer. Andrew Nealen, Rutgers, /13/2010 1

Basic Graphics Programming

RECITATION - 1. Ceng477 Fall

Computer Graphics 1 Computer Graphics 1

Luiz Fernando Martha André Pereira

Introduction to Computer Graphics with OpenGL/GLUT

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

CENG 477 Introduction to Computer Graphics. Graphics Hardware and OpenGL

3D Graphics and OpenGl. First Steps

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

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

Exercise 1 Introduction to OpenGL

E.Order of Operations

COMP 371/4 Computer Graphics Week 1

Lecture 2 2D transformations Introduction to OpenGL

CS 4204 Computer Graphics

Rendering Objects. Need to transform all geometry then

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

SOURCES AND URLS BIBLIOGRAPHY AND REFERENCES

Rendering. Part 1 An introduction to OpenGL

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

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

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Introduction to OpenGL

Computer graphic -- Programming with OpenGL I

Programming of Graphics

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

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

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

Computer Graphics, Chapt 08

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Rendering Pipeline/ OpenGL

Computer Graphics Primitive Attributes

OpenGL refresher. Advanced Computer Graphics 2012

GL_MODELVIEW transformation

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Models and Architectures

Programming with OpenGL Part 1: Background

Computer Graphics. Chapter 10 Three-Dimensional Viewing

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

An Interactive Introduction to OpenGL and OpenGL ES Programming. Ed Angel Dave Shreiner

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Introduction to OpenGL

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

Lectures OpenGL Introduction

World Coordinate System

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

Computer Graphics Introduction to OpenGL

Computer Graphics. OpenGL

CSE4030 Introduction to Computer Graphics

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

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

CHAPTER 1 Graphics Systems and Models 3

OpenGL Transformations

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics CS 460. Software. Computer Graphics. 2. Medium Level (General Programming Packages)

Introduction to Computer Graphics with WebGL

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

Module 13C: Using The 3D Graphics APIs OpenGL ES

OpenGL/GLUT Intro. Week 1, Fri Jan 12

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

Introduction to OpenGL

MB86290 Series 3D Graphics Library V02 User Manual The core API

Advanced Computer Graphics (CS & SE )

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

1.2 Basic Graphics Programming

GLUT. What is OpenGL? Introduction to OpenGL and GLUT

OpenGL Introduction Computer Graphics and Visualization

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

Computer Graphics. Chapter 3 Computer Graphics Software

蔡侑庭 (Yu-Ting Tsai) National Chiao Tung University, Taiwan. Prof. Wen-Chieh Lin s CG Slides OpenGL 2.1 Specification

Rasterization Overview

Computer Graphics. Bing-Yu Chen National Taiwan University

C OMPUTER G RAPHICS Thursday

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

Transcription:

http://www.opengl.org OpenGL Open Graphics Library Graphics API Delivered with UNIX, Win9x/2000/Me/Nt/Xp, Mac OS Direct3D (DirectX) is only Windows Utilizes the window system and event handling of the OS Often hardware supported (graphic cards) Derivative of Silicon Graphics GL library Language bindings to C, C++, Java, Fortran, Perl, Toolkits GLU OpenGL Utility Library Support for NURBS, Quadrics, etc. Delivered with OpenGL GLUT OpenGL Utility Toolkit Simplifies window handling User interface functions Header and library can be downloaded OpenGL Extensions allows new hardware innovations to be accessible through OpenGL 1

MESA http://www.mesa3d.org/ Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL. Mesa is OpenGL in all respects except the name. Distributed under the XFree86 license, Mesa is not a licensed implementation of OpenGL and has not been tested by the OpenGL conformance tests. You can consider Mesa to be OpenGL; you can use OpenGL documentation, for example. Goals for OpenGL Industry-wide acceptance Consistent implementations Innovative implementations Scalable Long life High quality Non-goals for OpenGL Making graphics programming easy OpenGL is a power tool Easy to use for skilled programmers 2

Why/Why not OpenGL + Supporting O.S. + Open (kind of) + Free versions (Mesa) - Can be hard to use in structured programming. State machine. ( OpenGL is the assembler of computer graphics ) The Open GL Rendering Pipeline Vertex operations Transforms, projections, texture coordinates, lighting, clipping, Pixel operations Unpack (RGB, RGBA, LUMINANCE, ), scale, clamp, image processing Send to framebuffer or texture memory 3

The Open GL Rendering Pipeline Rasterization Fragment ~ pixel Consider line width, point size, shading model Color and depth are assigned for each fragment Fragment operations Alter or even throw out fragments Blending, anti-aliasing, depth-buffer OpenGL State machine Set a state remains the same until changed Example: The current color glcolor3f(1.0,0.0,0.0); Every object will be red until new call Many, many state variables can be set glenable, gldisable 4

Defining primitives in OpenGL OpenGL is using a right hand system Vertices are defined using glvertex*() Primitive defining statements all starts with glbegin(<primitive_type>) and ends with glend() Some primitive types GL_POINTS GL_LINES GL_LINESTRIP GL_TRIANGLES GL_QUADS GL_POLYGON Example (2D) glbegin(gl_line_loop); glvertex2f(-0.5,-0.5); glvertex2f( 0.5,-0.5); glvertex2f( 0.5, 0.5); glvertex2f(-0.5, 0.5); glend(); 5

glbegin(gl_line_strip); glvertex2f(-0.5,-0.5); glvertex2f( 0.5,-0.5); glvertex2f( 0.5, 0.5); glvertex2f(-0.5, 0.5); glend(); Another example (2D) The Camera Model Position Direction (look at) View up vector Projection Matrix (orthographic, perspective, etc..) glfrustum( ); gluperspective( ); glortho( ); Three matrix stacks GL_PROJECTION Camera (projection) matrix and window to viewport GL_MODELVIEW Model and View matrix GL_TEXTURE Texture transform matrix glmatrixmode(gl_modelview) glpushmatrix() / glpopmatrix() Transformations glmatrixmode(gl_modelview); glloadidentity(); gltranslatef(4.0, 5.0, 6.0); glrotatef(45.0, 1.0, 2.0, 3.0); gltranslatef(-4.0, -5.0, -6.0); The rule in OpenGL is: The transformation specified most recently is the one applied first. C=T(4.0,5.0,6.0)R(45)T(-4.0,-5.0,-6.0) q=cp 6

OpenGL (glut) Callback Functions Used for Input and Interaction The user submits a pointer to a function which OpenGL calls when the corresponding event occurs. glutmousefunc(function); // click glutmotionfunc(function); // drag glutreshapefunc(function); // window resize glutkeyboardfunc(function); // keyboard glutidlefunc(function); // animation glutdisplayfunc(function); // draw primitives OpenGL Applications Open Inventor Maya Milkshape VRML viewers (Cosmo Player) Doom, Halflife, Medal of Honor, Quake Useful links OpenGL.org - www.opengl.org Red Book Online - http://www.dcc.unicamp.br/~lmarcos/cours es/mc603/redbook/ NeHe Tutorials - http://nehe.gamedev.net/ 7