Download OpenGL Introduction

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Hold-And-Modify wikipedia , lookup

Direct3D wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

General-purpose computing on graphics processing units wikipedia , lookup

BSAVE (bitmap format) wikipedia , lookup

Tektronix 4010 wikipedia , lookup

Video card wikipedia , lookup

DirectX wikipedia , lookup

Free and open-source graphics device driver wikipedia , lookup

Intel GMA wikipedia , lookup

Apple II graphics wikipedia , lookup

Waveform graphics wikipedia , lookup

Framebuffer wikipedia , lookup

Molecular graphics wikipedia , lookup

Rendering (computer graphics) wikipedia , lookup

2.5D wikipedia , lookup

InfiniteReality wikipedia , lookup

Graphics processing unit wikipedia , lookup

Mesa (computer graphics) wikipedia , lookup

OpenGL wikipedia , lookup

Transcript
Tools of the Trade
CSC505
Design Tools
• Tools for creating 2D and 3D graphics off-line
– Model building
– Animation
– Particle effects
• Pyrotechnic, atmospheric, fluid…
– Scene graph management
– Shaders
– Textures
• Fur, hair, clothing…
CSC505
Design Tools
• Alias – Maya, now owned by AutoDesk
– www.alias.com
– $$$
• Discreet – 3DS Max (3D Studio Max), now owned by
AutoDesk
– www.discreet.com
– $$$
• Renderman
– renderman.pixar.com
– $$$
• Chumbalum-soft – MilkShape 3D
– http://www.swissquake.ch/chumbalum-soft/
– Shareware
CSC505
Programming Libraries
• Libraries for creating 2D and 3D graphics realtime
– Provide access to graphics hardware accelerators
– Provide software emulation in the absence of
hardware accelerators
– Describe 3D objects
– Describe properties of 3D objects
• Texture, color, shading, lighting, etc.
– Describe 3D viewing geometries
CSC505
Programming Libraries
• OpenGL
– Multi-platform
– www.opengl.org
– 3D graphical libraries
• Microsoft DirectX
– Windows platform
– www.microsoft.com/windows/directx/
– User interface libraries
CSC505
Programming Libraries
• Java 3D API
– Multi-platform
– java.sun.com/products/java-media/3D/
– User interface libraries
• Java OpenGL
– OpenGL library for Java
– opengl.j3d.org
– Various others
• Virtual Reality Mark-up Language (VRML)
– www.vrmlsite.com
– Internet based 3D content creation
CSC505
OpenGL
• What is OpenGL?
– Came out of Silicon Graphics (SGI)in the early
90’s (was IRIS GL specifically for their graphic
workstations)
• A software interface to graphics hardware
–
–
–
–
Provide a uniform API
Hardware independent
Operating system independent
About 200 core commands
CSC505
OpenGL
• What if your graphics hardware doesn’t
support OpenGL?
– Then OpenGL will run in pure software mode
CSC505
OpenGL
• What OpenGL does not do
– It does not provide support for user interface
devices
– It does not provide audio support
– It does not provide game play support
– It does not provide network interface support
• It merely provides access to your graphics
hardware
CSC505
OpenGL Basics
• 3D graphics – nothing more, nothing less
• There is no user interface definition
• But…there are available libraries and SDKs
– GL Utility Toolkit (GLUT)
• http://www.opengl.org
– Flash Light Toolkit (FLTK – Full Tick)
• http://www.fltk.org/
– Jules' Utility Class Extensions (JUCE)
• http://www.rawmaterialsoftware.com/juce/
CSC505
OpenGL Basics
• All the primitive tools we’ve looked at are
included
–
–
–
–
–
–
–
Line drawing (polygon)
Shading
Lighting
Projections (orthographic, perspective)
Hidden surface removal
Texture mapping
Alpha blending
CSC505
OpenGL Basics
• Special effects
– Motion-blur
– Fog
– Depth-of-field (depth-of-focus)
CSC505
OpenGL Code
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);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
CSC505
OpenGL Concepts
• Modeled as a state machine
– You set states (modes) that remain in effect until
you change them
•
•
•
•
•
Current color
Viewing transformations
Line/polygon patterns
Lighting characteristics
Object material properties
– OpenGL State Machine
CSC505
OpenGL Rendering Pipeline
Vertex data
Pixel data
CSC505
OpenGL Rendering Pipeline
• Display List
– A storage area for holding objects to be displayed
at a later time
• Evaluators
– Conversion of parametric objects (e.g. curves) to
vertices
• Per-vertex operations
– Conversion of vertex primitives to screen objects
(4x4 matrix transformations among others)
CSC505
OpenGL Rendering Pipeline
• Primitive assembly
– Clipping (so things don’t display off the window),
culling (hidden surface removal), depth cues
(perspective transformations)
• Pixel operations
– Packing and unpacking of pixel data, scaling (for
size)
• Texture assembly
– Texture mapping
CSC505
OpenGL Rendering Pipeline
• Rasterization
– Conversion of geometric (polygons) and pixel data
to fragments (pixels in the frame buffer)
• Fragment operations
– Final modification of frame buffer pixels
(texturing, blending, dithering, masking, …)
CSC505
OpenGL Demonstrations
CSC505
Bibliography
• Books
– OpenGL Programming Guide (Red book)
• Dave Shreiner, Mason Woo, Jackie Neider, Tom Davis
• Addison Wesley publisher
– The OpenGL Reference Manual (Blue book)
• OpenGL Architecture Review Board, Shreiner
• Addison Wesley publisher
– OpenGL: A Primer
• Edward Angel
• Addison Wesley publisher
CSC505
Bibliography
• Books
– The Zen of Direct3D Game Programming
• Peter Walsh
• Prima Tech publisher
– Special Effects Game Programming With DirectX
• Mason McCuskey
• Premier Press publisher
– Physics for Game Developers
• David M. Bourg
• O’Reilly publisher
CSC505
Bibliography
• Periodicals
– Game Developer Magazine
• CMP publisher
• www.gdmag.com (free subscriptions available)
– Computer Graphics World
• PennWell publisher
• www.cgw.com (free subscriptions available)
– ACM Transactions on Graphics
– IEEE Computer Graphics and Applications
Magazine
CSC505
Bibliography
• Conferences
– ACM SIGGRAPH
• www.siggraph.org
– Game Developer’s Conference
• www.gdconf.com
– E3 (Electronic Entertainment Expo)
• www.e3expo.com
CSC505
Things To Do
• Tonight
– Final project proposal
• What is your project going to entail?
• What algorithms will you use?
• What will be the final deliverable?
– Programming help/questions
• Next week
– Demonstrate your deliverable to the class
– Write (and turn in) the report describing your project
CSC505