Download presentation
Presentation is loading. Please wait.
Published byArron Neal Modified over 9 years ago
1
CSE328:Computer Graphics OpenGL Tutorial Dongli Zhang Department of Computer Science, SBU dozhang@cs.stonybrook.edu Department of Computer Science, Stony Brook University (SUNYSB)
2
TA Information Department of Computer Science, Stony Brook University (SUNYSB) TA Schedule: Time: Tuesday: 4:30~6:00pm; Location: Computer Science Building, 2110; Email: dozhang@cs.stonybrook.edu
3
Introduction to OpenGL CSE328 What is OpenGL? Industrial standard library for doing computer graphics. Developed by Silicon Graphics Inc.(SGI) in 1992. Latest version: 4.3 (released at Aug 6, 2012). Features: Keep developing. More functions,GLSL,64-bit support. OpenGL is a Graphic rendering API (software interface to graphics hardware) consists of lots of commands. for example: GL_BEGIN(GLint TYPE) Operating system independent. References: http://en.wikipedia.org/wiki/Opengl http://www.opengl.org/
4
Introduction to OpenGL CSE328 If you want to be a Software Engineer in Computer graphics area, OpenGL is a MUST! Giant Companies: NVidia, ATI(AMD),Google, Adobe, Pixar, Blizzard, Siemens Medical…
5
Introduction to OpenGL CSE328 Other 3D Graphics APIs: Direct3D --- a competitor to OpenGL. Mesa 3D --- an open source implementation of OpenGL. Open Inventor --- C++ object oriented 3D graphics API in higher layer of programming. RISpec --- Pixar’s open API for photorealistic off-line rendering. Other 2D graphics APIs: GTK+. Java 2D, QT
6
OpenGL programming guide CSE328 Things you should know before coding: 1.OpenGL was designed be graphic output-only. Provide rendering functions only. Core API has no concept of windowing systems, audio, printing to screening, keyboard/mouse or other input devices. 2.OpenGL need add-on APIs to interact with the host system. GLX --- X11 WGL --- Microsoft Windows CGL --- Mac OS X 3.For convenient, people developed libraries to provide functionality for basic windowing using OpenGL, such as GLUT. OpenGL need a GUI in window system.
7
OpenGL programming guide Tools for programming: –C/C++ compiler and debugger: MS, gcc. –IDE: MS Visual studio, Dev-C++, Eclipse+cdt, Xcode, … –GUI: GLUT + GLUI, QT, MFC… Recommendation: VS2010 + GLUT + GLUI(QT) Reasons: free, easy for debug.
8
OpenGL language A state machine 1.You put OpenGL into various states that then remain in effect until you change them 2.State is encapsulated in contexts. Each OpenGL window has its own, separate, state. 3.Think of each context as a C/C++ struct with fields for each OpenGL state variable. Generally, there are two operations that you do with OpenGL: 1.Draw something 2.Change the state of how OpenGL draws OpenGL has two types of things that it can render: 1.Geometric primitives: points, lines and polygons 2.Image Primitives: bitmaps and graphics image Additionally, OpenGL links images and geometric primitives together using Texture Mapping.
9
OpenGL language
15
OpenGL geometric primitives
24
Rendering
26
Controlling current state
27
GLUT
28
What can GLUT do?
29
GLUT programming
30
Initialization
32
Open a window
34
Handle Events
35
Handle Event
36
Handle events
37
GLUT
43
Enter event processing loop
44
GLUT summary
45
GLUT Menu
47
Put together
50
GLUI
52
Examples
53
Helpful sources
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.