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

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


Computer graphics MN1

Basic Graphics Programming

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

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

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

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

Introduction to OpenGL

Lecture 4 of 41. Lab 1a: OpenGL Basics

C OMPUTER G RAPHICS Thursday

Basic Graphics Programming

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

Computer graphics MN1

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Precept 2 Aleksey Boyko February 18, 2011

Using OpenGL with CUDA

Understand how real-world lighting conditions are approximated by OpenGL

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

Modeling Transform. Chapter 4 Geometric Transformations. Overview. Instancing. Specify transformation for objects 李同益

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

Introduction to OpenGL

Programming with OpenGL Part 3: Three Dimensions

Outline. Other Graphics Technology. OpenGL Background and History. Platform Specifics. The Drawing Process

Graphics and Computation Introduction to OpenGL

Introduction to Computer Graphics with OpenGL/GLUT

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

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

Programming using OpenGL: A first Introduction

by modifying the glutinitwindowsize() function you can change the screen size to whatever you please.

Graphics Pipeline & APIs

Computer Graphics Introduction to OpenGL

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

Introduction to OpenGL

Lectures OpenGL Introduction

Graphics Pipeline & APIs

Computer Graphics. OpenGL

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

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

Lecture 2 2D transformations Introduction to OpenGL

COMPUTER GRAPHICS LAB # 3

Computer graphics MN1

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

OpenGL refresher. Advanced Computer Graphics 2012

Rendering Pipeline/ OpenGL

Transformation, Input and Interaction. Hanyang University

Computer Graphics. Transformations. CSC 470 Computer Graphics 1

Interaction Computer Graphics I Lecture 3

Computer Graphics. Bing-Yu Chen National Taiwan University

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1

Lecture 3. Understanding of OPenGL programming

Programming with OpenGL Part 1: Background

Introduction to OpenGL: Part 2

RECITATION - 1. Ceng477 Fall

1.2 Basic Graphics Programming

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

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

Getting Started. Overview (1): Getting Started (1): Getting Started (2): Getting Started (3): COSC 4431/5331 Computer Graphics.

CS 4204 Computer Graphics

Graphics Programming

Computer Graphics (Basic OpenGL)

Computer Graphics Primitive Attributes

Announcements OpenGL. Computer Graphics. Spring CS4815

Source code: #include <iostream>

Announcements OpenGL. Computer Graphics. Autumn 2009 CS4815

Interaction. CSCI 480 Computer Graphics Lecture 3

Chapter 13 Selection and Feedback

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

An Interactive Introduction to OpenGL Programming

Display Lists in OpenGL

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008

2 Transformations and Homogeneous Coordinates

Chapter 7 Display Lists

Computer Graphics. Chapter 10 Three-Dimensional Viewing

Lighting. Chapter 5. Chapter Objectives. After reading this chapter, you'll be able to do the following:

Chapter 3: Modeling Transformation

Order of Transformations

3D Graphics and API with OpenGL

CS 591B Lecture 9: The OpenGL Rendering Pipeline

CS 432 Interactive Computer Graphics

COMP 371/4 Computer Graphics Week 1

CSC 470 Computer Graphics

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

Computer Graphics, Chapt 08

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

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Interaction. CSCI 420 Computer Graphics Lecture 3

Computer Graphics Introduction to OpenGL

1 /* 4 C:\opencv\build\include. 6 C:\opencv\build\x86\vc10\lib

2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3

Lecture 3 Advanced Computer Graphics (CS & SE )

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

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

OpenGL. Toolkits.

compatibility mode core mode

2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-

Introduction to OpenGL Week 1

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

Transcription:

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D CS334 Spring 2012 Daniel G. Aliaga Department of Computer Science Purdue University

Computer Graphics Pipeline Geometric Primitives Modeling Transformation Lighting Viewing Transformation Clipping Projection Transformation Scan Conversion Transform into 3D world coordinate system Simulate illumination and reflectance Transform into 3D camera coordinate system Clip primitives outside camera s view Transform into 2D camera coordinate system Draw pixels (incl. texturing, hidden surface ) Image

Books (and by now means complete ) Interactive Computer Graphics Angel and Shreiner, pub: Addison Wesley 3D Computer Graphics Watt, pub: Addison Wesley Real-time Rendering Moller and Haines, pub: AK Peters 3D Game Engine Design Eberly, pub: Morgan Kaufmann Level of Detail for 3D Graphics Luebke, Reddy, Cohen, Varshney, Watson, and Huebner, pub: Morgan Kaufmann Computer Graphics (a.k.a The Bible, a bit dated ) Foley, van Dam, Feiner, and Hughes, pub: Addison Wesley

Linear Algebra Why do we need it? Modeling transformation Move objects into place relative to a world origin Viewing transformation Move objects into place relative to camera Perspective transformation Project objects onto image plane

OpenGL Software interface to graphics hardware ~150 distinct commands Hardware-independent and widely supported To achieve this, no windowing tasks are included GLU (Graphics Library Utilities) Provides some higher-level modeling features such as curved surfaces, objects, etc. Open Inventor (old) A higher-level object-oriented software package

OpenGL Online Current version is: 4.X Website http://www.opengl.org Books Programming Guide ( Red book ) Reference Manual ( Blue book )

OpenGL Rendering parameters Lighting, shading, lots of little details Texture information Texture data, mapping strategies Matrix transformations Projection Model view (Texture) (Color)

Matrix Transformations

Matrix Transformations Each of modelview and projection matrix is a 4x4 matrix OpenGL functions glmatrixmode( ) glloadidentity( ) glloadmatrixf( ) glmultmatrix( ) gltranslate( ) glscale( ) glrotate( ) glpushmatrix() glpopmatrix()

Matrix Transformations glmatrixmode(gl_modelview); glloadidentity(); glmultmatrixf(n); /* apply transformation */ glmultmatrixf(m); /* apply transformation M */ glmultmatrixf(l); /* apply transformation L */ glbegin(gl_points); glvertex3f(v); /* draw transformed vertex v */ glend(); = draw transformed point N(M(Lv))

Modelview Transformations glrotatef(45,0,0,1) gltranslate3f(tx,ty,tz) glscalef(2,-0.5,1.0)

Modelview Transformations glrotatef(d,rx,ry,rz); gltranslate3f(tx,ty,tz); gltranslate3f(tx,ty,tz); glrotatef(d,rx,ry,rz);

Simple OpenGL Program <Initialize OpenGL state> <Load and define textures> <Specify lights and shading parameters> <Load projection matrix> For each frame <Load model view matrix> <Draw primitives> End frame

Simple OpenGL Program #include <GL/gl.h> main() InitializeAWindowPlease(); glmatrixmode(gl_projection); glortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); glclearcolor (0.0, 0.0, 0.0, 0.0); glclear (GL_COLOR_BUFFER_BIT); glcolor3f (1.0, 1.0, 1.0); glmatrixmode(gl_modelview); glloadidentity(); gltranslate3f(1.0, 1.0, 1.0): glbegin(gl_polygon); glvertex3f (0.25, 0.25, 0.0); glvertex3f (0.75, 0.25, 0.0); glvertex3f (0.75, 0.75, 0.0); glvertex3f (0.25, 0.75, 0.0); glend(); glflush(); UpdateTheWindowAndCheckForEvents();

GLUT = Graphics Library Utility Toolkit Adds functionality such as windowing operations to OpenGL Event-based callback interface Display callback Resize callback Idle callback Keyboard callback Mouse movement callback Mouse button callback

Simple OpenGL + GLUT Program #include < > DisplayCallback() <Clear window> <Load Projection matrix> <Load Modelview matrix> <Draw primitives> (<Swap buffers>) IdleCallback() <Do some computations> <Maybe force a window refresh> KeyCallback() <Handle key presses> KeyCallback() <Handle key presses> MouseMovementCallback <Handle mouse movement> MouseButtonsCallback <Handle mouse buttons> Main() <Initialize GLUT and callbacks> <Create a window> <Initialize OpenGL state> <Enter main event loop>

Simple OpenGL + GLUT Program #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> void init(void) glclearcolor (0.0, 0.0, 0.0, 0.0); glshademodel (GL_FLAT); void display(void) glclear (GL_COLOR_BUFFER_BIT); glcolor3f (1.0, 1.0, 1.0); glloadidentity (); glulookat (0, 0, 5, 0, 0, 0, 0, 1, 0); glscalef (1.0, 2.0, 1.0); glutwirecube (1.0); glflush (); void reshape (int w, int h) glviewport (0, 0, (GLsizei) w, (GLsizei) h); glmatrixmode (GL_PROJECTION); glloadidentity (); glfrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0); glmatrixmode (GL_MODELVIEW); int main(int argc, char** argv) glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB); glutinitwindowsize (500, 500); glutinitwindowposition (100, 100); glutcreatewindow (argv[0]); init (); glutdisplayfunc(display); glutreshapefunc(reshape); glutmainloop(); return 0;

Simple OpenGL + GLUT Program

Example Program with Lighting #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> void init(void) GLfloat mat_specular[] = 1.0, 1.0, 1.0, 1.0 ; GLfloat mat_shininess[] = 50.0 ; GLfloat light_position[] = 1.0, 1.0, 1.0, 0.0 ; glclearcolor (0.0, 0.0, 0.0, 0.0); glshademodel (GL_SMOOTH); glmaterialfv(gl_front, GL_SPECULAR, mat_specular); glmaterialfv(gl_front, GL_SHININESS, mat_shininess); gllightfv(gl_light0, GL_POSITION, light_position); glenable(gl_lighting); glenable(gl_light0); glenable(gl_depth_test); void display(void) glclear (GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT); glutsolidsphere (1.0, 20, 16); glflush (); void reshape (int w, int h) glviewport (0, 0, (GLsizei) w, (GLsizei) h); glmatrixmode (GL_PROJECTION); glloadidentity(); if (w <= h) glortho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w, 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0); else glortho (-1.5*(GLfloat)w/(GLfloat)h, 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0); glmatrixmode(gl_modelview); glloadidentity(); int main(int argc, char** argv) glutinit(&argc, argv); glutinitdisplaymode (GLUT_SINGLE GLUT_RGB GLUT_DEPTH); glutinitwindowsize (500, 500); glutinitwindowposition (100, 100); glutcreatewindow (argv[0]); init (); glutdisplayfunc(display); glutreshapefunc(reshape); glutmainloop(); return 0;

= Graphics Library User Interface GLUI

= Graphics Library User Interface GLUI

= Graphics Library User Interface GLUI

CUDA and OpenCL NVIDIA defined CUDA (new) Compute Unified Device Architecture http://www.nvidia.com/object/cuda_home.html# Khrono s group defined OpenCL (newer) Open Standard for Parallel Programming of Heterogeneous Systems http://www.khronos.org/opencl/

CUDA Example Rotate a 2D image by an angle On the CPU (PC) simple-tex.pdf On the GPU (graphics card) simple-tex-kernel.pdf

OpenCL Example Compute a Fast Fourier Transform On the CPU (PC) cl-cpu.pdf On the GPU (graphics card) cl-gpu.pdf

OpenCV A library for computer-vision related software Derived from research work and highperformance code from Intel http://opencv.willowgarage.com/wiki/

Point Clouds For 3D point cloud processing and rendering http://www.pointclouds.org

Microsoft XNA A Visual Studio programming environment to create games for Windows Phone, Xbox 360, and Windows-based computers http://www.microsoft.com/download/en/details. aspx?id=23714

G3D The G3D Innovation Engine is an open-source commercial-grade C++ 3D engine used in commercial games, research papers, military simulators, and university courses. supports hardware accelerated real-time rendering, off-line rendering like ray tracing, and general purpose computation on GPUs. http://g3d.sourceforge.net