Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Introduction to 3D graphics

Introduction to 3D CG and OpenGL programming
by

Claudia Esteves

on 12 February 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Introduction to 3D graphics

with OpenGL
Introduction to 3D Computer Graphics
History of Computer Graphics
CG Pipeline
OpenGL
First OpenGL Example
An example using shaders
Dra. Claudia Esteves
cesteves@cimat.mx

http://www.xtimeline.com/timeline/History-of-computer-graphics
1950
2D CG start
use of vector graphics
1959
TX-2 computer @ MIT
wikimedia commons
http://www.billbuxton.com/Lincoln.html
William Fetter from Boeing Inc. uses the term "Computer Graphics" for the first time.

Major corporations take interest in CG
1961
First interactive video game: "Spacewars" by Steve Russell from MIT.
wikimedia commons
1960
1962
Ivan Sutherland's Sketchpad
1963
E.E. Zajak satellite simulator
1969
SIGGRAPH was initiated by ACM
1971
1975
Martin Newell's teapot (UTAH)
The movie "Futureworld" uses for the first time CG rendered by Ed Catmull and Fred Park in Utah.
1976
William Fetter from Boeing develops iconic "First man"
1978
3D CG start
http://wanlinksniper.blogspot.mx/2009/10/william-fetter-and-boeing-man.html
wikimedia commons
1980
Use of GUI to present graphical content: XEROX-PARC
Gouraud's shading technique
1982
SGI is founded
wikimedia commons
http://www.sgi.faktor0.de/cube.html
1984
Radiosity is introduced
First Macintosh
Jim Blinn's Bump Mapping
The Adventures of André & Wally B
http://www.myapplespace.com/
wikimedia commons
wikimedia commons
First SIGGRAPH conference
1986
Pixar is purchased from Lucasfilm by Steve Jobs
CGI group starts at Industrial Light and Magic
Waldo project introduces motion capture
Luxo Jr. nominated for an Oscar
1987
LucasArts formed
Adobe Illustrator
SUN 4 SPARC workstation
Reynold's flocking behavior algorithm
Marching cubes algorithm
1992
by SGI
...
perspective
3D
3D approximation
http://www.how-to-draw-and-paint.com/perspective-drawing.html
wikimedia commons
vertices
vertex transformation
vertex connectivity
primitive assembly
fragment texturing and coloring
raster operations
geometric transformations
vertex coloring
rasterization
vertex connectivity
transformed vertices
pixel positions
fragment texturing and coloring
color fragments
fragments
transformed vertices
pixel updates
programable vs. fixed pipeline
from OpenGL Superbible
http://goanna.cs.rmit.edu.au/~gl/teaching/rtr&3dgp/notes/pipeline.html
(cc) http://p6ril.files.wordpress.com/2010/04/light_switch.gif
software interface to graphics hardware.
3D graphics library and modeling library that is very portable and very fast.
API + GLSL
prepackaged functionalities to implement the graphics pipeline (flow and logic).
C-like programming language for rendering operations (not the flow and logic)
Software (e.g. Mesa3D) and hardware implementations
2D library
OpenGL
of
Evolution
OpenGL Standard
IRIS GL from SGI
3D programming API
for IRIS graphics workstations
ultra-fast matrix transforms
hardware support for depth buffering
...
from SGI
OpenGL Architecture Review Board (ARB)
OpenGL 1.0 (01/07/1992)
2006
Hardware (AMD, NVIDIA, Apple, Intel ... ) vendors have their own implementation according to the standard set by Khronos.
standard API +
extensions
glext.h
Vendor
Prefix
Silicon Graphics
SGI_
(cc) image by anemoneprojectors on Flickr
ATI Techonologies
ATI_
AMD_
NV_
IBM_
WGL_
EXT_
ARB_
Advanced Micro Devices
NVIDIA
IBM
Microsoft
Cross-vendor
ARB Approved
2010
OpenGL 3.3 & 4.0
GLUT (QT or any other GUI)
GLEW
GLTOOLS
OpenGL utility toolkit
Extension wrangler library
toolkit with useful functionalities from the authors of the OpenGL SuperBible
glEnable( GLenum capability );
glDisable( GLenum capability );
GLboolean glIsEnabled( GLenum capability );
?
// OpenGL Super Bible example 2.1
// Our first OpenGL program that will just draw a triangle on the screen

#include

<GLTools.h>

// OpenGL toolkit
#include

<GLShaderManager.h>

// Shader Manager Class

#ifdef __APPLE__
#include

<GLUT/glut.h>

// OSX version of GLUT
#else
#define FREEGLUT_STATIC
#include

<GL/glut.h>

// Windows and Linux
#endif
/* ---------------------------------------------------------
* Main entry point for GLUT based programs
* --------------------------------------------------------- */

int

main(
int
argc,
char
* argv[

] )
{
gltSetWorkingDirectory( argv[
0
] );

glutInit( &argc, argv );
glutInitDisplayMode(
GLUT_DOUBLE
|
GLUT_RGBA
|
GLUT_DEPTH
|
GLUT_STENCIL
);
glutInitWindowSize(
800
,
600
);
glutCreateWindow(
"Triangle"
);
// setup rendering context

glutReshapeFunc( ChangeSize );
glutDisplayFunc( RenderScene );


// Make sure everything is ok with the driver initialization

GLenum
err = glewInit();
if(
GLEW_OK
!= err ){
fprintf( stderr, "GLEW Error: %s\n", glewGetErrorString(err) );

return

1
;
}

SetupRC();

glutMainLoop();
// return until the main window is closed

return

0
;
}
/* ---------------------------------------------------------
* Window has changed size, or has just been created. In
* either case, we need to use window dimensions to set the
* viewport and the projection matrix.
* --------------------------------------------------------- */

void
ChangeSize(
int
w,
int
h )
{
// void glViewport( GLint x, GLint y, GLsizei width, GLsizei height );
glViewport(
0
,
0
, w, h );

}
OpenGL SuperBible
/* ---------------------------------------------------------
* This function does any needed initialization on the
* rendering context. First OpenGL-related tasks: preload
* textures, set up geometry, shaders, etc.
* --------------------------------------------------------- */

void

SetupRC()
{
// blue background
glClearColor(
0.0
f,
0.0
f,
1.0
f,
1.0
f );

shaderManager.InitializeStockShaders();


// Load up a triangle
GLfloat
vVerts[] = {
-0.5
f,
0.0
f,
0.0
f,

0.5
f,
0.0
f,
0.0
f,

0.0
f,
0.5
f,
0.0
f };

triangleBatch.Begin(
GL_TRIANGLES
,
3
);
triangleBatch.CopyVertexData3f( vVerts );
triangleBatch.End();
}
/* ---------------------------------------------------------
* Called to draw scene
* --------------------------------------------------------- */

void
RenderScene(
void
)
{

// Clear the window with the current clearing color
glClear(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
|
GL_STENCIL_BUFFER_BIT
);


GLfloat
vRed[] = {
1.0
f,
0.0
f,
0.0
f,
1.0
f };
shaderManager.UseStockShader(
GLT_SHADER_IDENTITY
, vRed );
triangleBatch.Draw();


// Perform the buffer swap to display the back buffer
glutSwapBuffers();
}
1972
Identity shader (SuperBible)
identity.vp
#version

130

attribute vec4
vVertex;

void
main (
void
)
{
gl_Position = vVertex;
}
identity.fp
#version

130

uniform vec4
vColor;

void
main(
void
)
{
gl_FragColor = vColor;
}
Full transcript