html5-img
1 / 26

Introduction to OpenGL Programming

Introduction to OpenGL Programming. Jian-Liang Lin 2002. What is OpenGL? -1. OpenGL is a cross-platform standard for 3D rendering. and software interface to graphics hardware.

larya
Download Presentation

Introduction to OpenGL Programming

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. Introduction to OpenGL Programming Jian-Liang Lin 2002

  2. What is OpenGL? -1 • OpenGL is a cross-platform standard for 3D rendering. and software interface to graphics hardware. • The OpenGL Architecture Review Board(ARB), and independent consortium formed in 1992, governs the OpenGL specification. • OpenGL routines use the prefix gl.

  3. What is OpenGL? -2 • Designed as a hardware-independent interface and implemented on many different hardware platforms. • No commands for performing windowing tasks or obtaining user input are included in OpenGL. • You must work through whatever windowing system controls the particular hardware you're using.

  4. What is OpenGL? -3 • OpenGL doesn't provide high-level commands for describing models of three-dimensional objects. • With OpenGL, you must build up your desired model from a small set of geometric primitives. • points, lines, triangles, and polygons …etc.

  5. The Advantages of OpenGL • Industry standard • Fast • Portable • Easy to use • Well-documented

  6. OpenGL rendering pipeline

  7. Color Models • RGBA color • Red, Green, Blue, and Alpha channels • Up to 16M colors • Color-indexed • Small numbers of colors accessed by indices from a color lookup table(palette) • 8 bits = 256 colors

  8. Basic Features • Transformation • Materials Lighting & Smooth Shading • Texture mapping • Depth buffer test (Z-Buffer) • Alpha blending • Double buffering for animation • Pixel operations

  9. OpenGL Buffering -1 • OpenGL supports a variety of buffers for advanced rendering • Depended on driver implementation • Color buffers • Front-left, front-right, back-left, back-right, and any number of auxiliary buffers • Depth buffer • Also known as Z-Buffer for HSR

  10. OpenGL Buffering -2 • Alpha buffer • Blending • Stencil buffer • To restrict drawing to certain portions of the screen. (basic application) • Accumulation buffer • Full scene manipulation

  11. API Hierarchy

  12. OpenGL library -1 • SGI’s OpenGL SDK • OpenGL.DLL & GLU.DLL • Open source implementation for hardware vendor reference. • Best software rendering library. • Can be downloaded from SGI’s website.

  13. OpenGL library -2 • Microsoft’s implementation • From Win95 OSR2, Microsoft Windows ship with OpenGL32.DLL. • For old Win95 users, you still can download OPENGL95.EXE via Microsoft website. • Header files and import library files are already included in Win32 Platform SDK.

  14. OpenGL library -3 • Microsoft’s OpenGL32.DLL applies a hardware accelerated driver registered in Registry. • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers • You can search it by using REGEDIT.EXE

  15. Mesa Graphics Library • A OpenGL clone library. • You can use it as using OpenGL. • Portable on many OS. • You can download it in the following website • http://www.mesa3d.org/

  16. OpenGL Utility Library • The OpenGL Utility Library(GLU) provides many of the modeling features, such as quadric surfaces and NURBS curves and surfaces. • GLU is a standard part of every OpenGL implementation • GLU routines use the prefix glu. • gluLookAt( … ); • …

  17. Windows system related helper library • For every window system, there is a library that extends the functionality of that window system to support OpenGL rendering. • X Window System -> GLX • Microsoft Windows -> WGL • IBM OS/2 -> PGL

  18. OpenGL Utility Toolkit -1 • The OpenGL Utility Toolkit (GLUT) is a window system-independent toolkit, written by Mark Kilgard, to hide the complexities of differing window system APIs. • GLUT routines use the prefix glut. • glutPostRedisplay(); • …

  19. OpenGL Utility Toolkit -2 • You can download this toolkit in the following website • http://reality.sgi.com/mjk_asd/glut3/glut3.html • We focus on this toolkit.

  20. Programming Environment -1 • PC(X86) • OpenGL v1.1 software runtime is included as part of operating system for Win 2000, Windows 98, Windows 95 (OSR2) and Windows NT • Linux, FreeBSD, …other UNIX-like OS can use Mesa graphics library.

  21. Programming Environment -2 • SGI workstation • Personal IRIS, Indigo, Indy, Indigo2 O2, • Octane in CGGM Lab. • All with IRIS Operating System and X Window System

  22. Compilers – Microsoft Visual C++ • Start a new workspace of Win32 Console application. • Add OpenGL32.lib glu32.lib glut32.lib in Projects/Setting/Link/Library modules column for linking

  23. Compilers – Unix-like OS • Library files needed • libGL.so, libGLU.so, libglut.a, libX11.a, libX11.so …etc • Command line: • gcc [source files] –o [output file] –lglut –lGLU –lGL –lX11 –lm • The ordering of the linking flags is not changeable. • Suggest to write a Makefile.

  24. Where is the reference? • OpenGL official site • http://www.opengl.org • You refer to OpenGL API documentation in MSDN Library.

  25. How can you start? • Choose your platform • Get your desire OpenGL related library. • Start a GLUT simple program, build and test. • Refine the code as you wish. • Refer to some reference materials. • Consult with TA  • Feel happy to see the result.

  26. Any Question? ?

More Related