1 / 53

CSE528:Computer Graphics OpenGL Tutorial

CSE528: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:

giona
Download Presentation

CSE528:Computer Graphics OpenGL Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE528:Computer GraphicsOpenGL 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, Thursday: 4:00~5:30pm; • 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: • 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.

  7. 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

  8. 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

  9. OpenGL language

  10. OpenGL language

  11. OpenGL language

  12. OpenGL language

  13. OpenGL language

  14. OpenGL language

  15. OpenGL geometric primitives

  16. OpenGL geometric primitives

  17. OpenGL geometric primitives

  18. OpenGL geometric primitives

  19. OpenGL geometric primitives

  20. OpenGL geometric primitives

  21. OpenGL geometric primitives

  22. OpenGL geometric primitives

  23. OpenGL geometric primitives

  24. Rendering

  25. Rendering

  26. Controlling current state

  27. GLUT

  28. What can GLUT do? GLUT

  29. GLUT programming

  30. Initialization

  31. Initialization

  32. Open a window

  33. Open a window

  34. Handle Events

  35. Handle Event

  36. Handle events

  37. GLUT

  38. GLUT

  39. GLUT

  40. GLUT

  41. GLUT

  42. Enter event processing loop

  43. GLUT summary

  44. GLUT Menu

  45. GLUT Menu

  46. Put together

  47. GLUI

More Related