600 likes | 739 Views
CSE328:Computer Graphics OpenGL Tutorial. Dongli Zhang Department of Computer Science, SBU dozhang@cs.stonybrook.edu. Department of Computer Science, Stony Brook University (SUNYSB). TA Information. Department of Computer Science, Stony Brook University (SUNYSB). TA Schedule:
E N D
CSE328:Computer GraphicsOpenGL Tutorial Dongli Zhang Department of Computer Science, SBU dozhang@cs.stonybrook.edu Department of Computer Science, Stony Brook University (SUNYSB)
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
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/
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…
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
OpenGL programming guide CSE328 • Things you should know before coding: • 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. • OpenGL need add-on APIs to interact with the host system. • GLX --- X11 • WGL --- Microsoft Windows • CGL --- Mac OS X • For convenient, people developed libraries to provide • functionality for basic windowing using OpenGL, such as GLUT. OpenGL need a GUI in window system.
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. OpenGL programming guide
A state machine • You put OpenGL into various states that then remain in effect until you change them • State is encapsulated in contexts. Each OpenGL window has its own, separate, state. • 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: • Draw something • Change the state of how OpenGL draws • OpenGL has two types of things that it can render: • Geometric primitives: points, lines and polygons • Image Primitives: bitmaps and graphics image • Additionally, OpenGL links images and geometric primitives together using Texture Mapping. OpenGL language
What can GLUT do? GLUT