Scientific Visualization with OpenGL 22 February 2006.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

Chapter 2: Graphics Programming
Pemrograman OpenGL Dasar
CSC 461: Lecture 51 CSC461 Lecture 5: Simple OpenGL Program Objectives: Discuss a simple program Discuss a simple program Introduce the OpenGL program.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
30/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 1: Introduction.
Programming with OpenGL Part 0: 3D API March 1, 2007.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 What is Computer Graphics? Ed Angel Professor of Computer Science, Electrical and Computer.
Programming with OpenGL Part 1: Background Mohan Sridharan Based on slides created by Edward Angel CS4395: Computer Graphics 1.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
Computer Graphics/and Multimedia CMM472/CIT773 What is CG ?, History of CG, Course Overview.
Computer Graphics Bing-Yu Chen National Taiwan University.
1 Chapter 1: Graphics Systems and Models. 2 Applications of C. G. – 1/4 Display of information Maps GIS (geographic information system) CT (computer tomography)
B a c kn e x t h o m e CSCI 346 Chapter 1 Graphics Systems and Models.
Lecture 5 - Programming with OpenGL
Computer Graphics/and Multimedia CMM472/CIT773 What is CG ?, History of CG, Course Overview.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Computer Graphics Week3 –Graphics & Image Processing.
1 By Dr. Hany Elsalamony. 2 3  Computer graphics generally means creation, storage and manipulation of models and images  Such models come from diverse.
Introduction to OpenGL and GLUT GLUT. What is OpenGL? An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality.
Using OpenGL in Visual C++ Opengl32.dll and glu32.dll should be in the system folder Opengl32.dll and glu32.dll should be in the system folder Opengl32.lib.
CSC 461: Lecture 1 1 Lecture 1: Introduction Objectives Explore what computer graphics is about Survey some application areas Introduce a history of computer.
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
Graphics Architectures & OpenGL API Introduction Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 480/680 Computer Graphics Programming with Open GL Part 1: Background Dr. Frederick C Harris, Jr. Fall 2011.
Programming with OpenGL Part 1: Background
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Introduction to OpenGL Week 1 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico CS.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 1: Background Ed Angel Professor Emeritus.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Programming with OpenGL Review.
Introduction to OpenGL and GLUT. What’s OpenGL? An Application Programming Interface (API) A low-level graphics programming API – Contains over 250 functions.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 What is Computer Graphics?
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 43 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 43 Computer Graphics Programming with OpenGL I.
NoufNaief.net TA: Nouf Al-harbi.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
1 Chapter 1: Graphics Systems and Models. 2 Applications of C. G. – 1/4 Display of information Maps GIS (geographic information system) CT (computer tomography)
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 1 Graphics Systems and Models Models and Architectures.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Hank Childs, University of Oregon Oct. 28th, 2016 CIS 441/541: Introduction to Computer Graphics Lecture 16: textures.
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 2: Complete Programs
Models and Architectures
Programming with OpenGL Part 2: Complete Programs
Introduction to Computer Graphics with WebGL
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Programming with OpenGL Part 1: Background
Models and Architectures
Models and Architectures
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 1: Background
Programming with OpenGL Part 2: Complete Programs
Presentation transcript:

Scientific Visualization with OpenGL 22 February 2006

Agenda Wrap-up Project 1 OpenGL Homework –Read Chapters 1 and 2 in Cunningham –Study for next week’s Quiz 3 User Testing Chapter 0 – Getting Started in Cunningham

Computer Graphics Definition producing pictures or images using a computer 40 years ago –drawing lines on a cathode ray tube Today –produce images indistinguishable from photos –produce “realistic” and animated dinosaurs –produce 3D worlds

Computer Graphics Applications Display of Information Design Simulation User Interfaces

Display of Information Maps –GIS –Spatial Resource Planning (SRP) Medicine –MRI –Ultrasound Scientific Visualization –“seeing the unseen” –Visual Human Project –biology –electrophysiology –mathematics

GIS Buncombe Co. GIS

Spatial Resource Planning Spatially-referenced data within engineering, operations and distribution network management Analogous to what Enterprise Resource Planning (ERP) solutions do for data held in accounting, human resources, procurement and project management systems,

Magnetic Resonance Imaging Uses magnetism and radio waves to produce images

Ultrasound Images are produced by very high frequency sound waves of between 3.5 to 5.0 megahertz.

Scientific Visualization Electrophysiology Computed Potential Distribution on the Cardiac Surface during reentry: Spiral Tip Meandering, an arrhythmia model

Design “The evaluation of alternative solutions and the specification of a solution” CAD VLSI design Generate a possible design, test, use solution as a basis for other solution

Simulation Flight Simulators Games Educational (edutainment) software Virtual Reality

User Interfaces Interaction with computers –windows –icons –menus –a pointing device

Frame Buffer Depth -- number of bits used for each pixel –full color systems true color systems RGB color systems 24 or more bits per pixel Resolution -- number of pixels in the frame buffer

Output Devices Dominant type of display is the CRT (cathode ray tube). CRT emits light for a short time -- a few milliseconds. For a human to see a steady image the path must be retraced or refreshed at least 50x/sec. How are pixels displayed?

How Are Pixels Displayed? Noninterlaced –Displayed row by row Interlaced –Displayed every other row –50-75X/second (50-75Hertz) –60Hz display refreshes the entire screen 30x/sec –Commercial TV

Color CRTs 3 phosphors Arranged in (sometimes triangular) triads Shadow mask CRT Screen with small holes ensures only one phosphor is excited

Other [Amazing] Raster Output Devices Liquid Crystal Displays (LCD) Printers

Ways to Read an Input Device Sampling –What is its input right now ? Event-based –Wait until the user does something

Objects and Viewers 3d world Object is a constant Viewer forms the image –human viewing system - back of eye –camera - film plane –different viewers see the same object differently

The Human Vision System Resolution –the measure of what size objects we can see –how close we can place two points and they remain distinct Intensity –physical measure of light energy Brightness –measure of how intense we perceive the light to be.

Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts: University of New Mexico

Objectives Development of the OpenGL API OpenGL Architecture –OpenGL as a state machine Functions –Types –Formats Simple program

Early History of APIs IFIPS (1973) formed two committees to come up with a standard graphics API –Graphical Kernel System (GKS) 2D but contained good workstation model –Core Both 2D and 3D –GKS adopted as IS0 and later ANSI standard (1980s) GKS not easily extended to 3D (GKS-3D) Far behind hardware development

PHIGS and X Programmers Hierarchical Graphics System (PHIGS) –Arose from CAD community –Database model with retained graphics (structures) X Window System –DEC/MIT effort –Client-server architecture with graphics PEX combined the two –Not easy to use (all the defects of each)

SGI and GL Silicon Graphics (SGI) revolutionized the graphics workstation by implementing the pipeline in hardware (1982) To use the system, application programmers used a library called GL With GL, it was relatively simple to program three dimensional interactive applications

OpenGL The success of GL lead to OpenGL (1992), a platform-independent API that was –Easy to use –Close enough to the hardware to get excellent performance –Focus on rendering –Omitted windowing and input to avoid window system dependencies

OpenGL Evolution Controlled by an Architectural Review Board (ARB) –Members include SGI, Microsoft, Nvidia, HP, 3DLabs,IBM,……. –Relatively stable –Evolution reflects new hardware capabilities –3D texture mapping and texture objects –Vertex programs –Allows for platform specific features through extensions

OpenGL Libraries OpenGL core library –OpenGL32 on Windows –GL on OS X/UNIX/Linux systems OpenGL Utility Library (GLU) –Provides functionality in OpenGL core but avoids having to rewrite code Links with window system –OpenGl does not “do” windowing –Windowing is OS specific

GLUT OpenGL Utility Library (GLUT) –Provides functionality common to all window systems Open a window Get input from mouse and keyboard Menus Event-driven –Code is portable but GLUT lacks the functionality of a good toolkit for a specific platform Slide bars

Software Organization GLUT GLU GL GLX, AGL or WGL X, Win32, Mac O/S software and/or hardware application program OpenGL Motif widget or similar

OpenGL Architecture Immediate Mode Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Texture Memory CPU Pixel Operations Frame Buffer Geometric pipeline

OpenGL Functions Primitives –Points –Line Segments –Polygons Attributes Transformations –Viewing –Modeling Control Input (GLUT)

OpenGL State OpenGL is a state machine OpenGL functions are of two types –Primitive generating Can cause output if primitive is visible How vertices are processes and appearance of primitive are controlled by the state –State changing Transformation functions Attribute functions

Lack of Object Orientation OpenGL is not object oriented so that there are multiple functions for a given logical function, e.g. glVertex3f, glVertex2i, glVertex3dv,….. Underlying storage mode is the same Easy to create overloaded functions in C++ but issue is efficiency

OpenGL function format glVertex3f(x,y,z) belongs to GL library function name x,y,z are floats glVertex3fv(p) p is a pointer to an array

OpenGL #defines Most constants are defined in the include files gl.h, glu.h and glut.h –Note #include should automatically include the others –Examples –glBegin(GL_PLOYGON) –glClear(GL_COLOR_BUFFER_BIT) include files also define OpenGL data types: Glfloat, Gldouble,….

A Simple Program Generate a square on a solid background

simple.c #include void mydisplay(){ glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush(); } int main(int argc, char** argv){ glutCreateWindow("simple"); glutDisplayFunc(mydisplay); glutMainLoop(); }

Event Loop Note that the program defines a display callback function named mydisplay –Every glut program must have a display callback –The display callback is executed whenever OpenGL decides the display must be refreshed, for example when the window is opened –The main function ends with the program entering an event loop

Graphics System as a Black Box User Program Graphics System Input/Output Devices Function Calls Data Output Input

Pipeline Architectures Example Benefits –translates well to computer graphics –four steps to producing an image transforms (rotations, scale, translations) clipper projector (from 3d to 2d) rasterizer (scan conversion process)

Camera Analogy (from the red book)

Stages of Vertex Transformation in OpenGL

The Geometry Pipeline: Stages and Mappings

3D Coordinate Systems LEFT HANDEDRIGHT HANDED X Z Y Z Y X

3D Geometry: Model Coordinate Systems modeling - The process of creating and defining this geometry is called –This is usually done by defining each object in terms of a coordinate system that makes sense for that particular object. –Ants vs Star Wars

3D Geometry: Graphics Pipeline MIT graphics

3D Geometry Clipping

3D Geometry Projections

3D Geometry Projections – Parallel vs Orthographic

Appearance Color - RBG or RGBA

Appearance Texture mapping

Appearance Depth buffering

A Basic OpenGL Program Download Heat Distribution Program Heat Distribution Program Open Xcode (Icon has blue rectangle with hammer) File / New Project Select Command Line Utility / C++ Tool Name the project heatflow Add heatflow.c to the project source files. Add System/Library/Frameworks/Glut.framework and System/Library/Frameworks/OpenGL.framework to the project.

An OpenGL Program Select Build and Run Fix the errors –For a Mac substitute for “glut.h” –With c main() should return an int. Change the return value of main(). Build and Run

Unique to C Definitions precede code statements in functions. main() returns an int. argv, argc