Download presentation
Presentation is loading. Please wait.
1
Now Playing: Homecoming Kanye West from Graduation Released September 11, 2007
2
OpenGL Programming II Rick Skarbez, Instructor COMP 575 September 13, 2007
3
Robot Ate My Homework Mark Shirra Vancouver Film School, SIGGRAPH 2006 Available online: http://www.vfs.com/showcase.php?id=7&category_id=10&project_id=858 Available online: http://www.vfs.com/showcase.php?id=7&category_id=10&project_id=858
4
Announcements Reminder: Homework 1 is due today Questions? Class next Tuesday (9/18) will be held in SN 014
5
Introduced the basics of OpenGL programming OpenGL is a state machine All objects are lists of vertices 2 matrices in OpenGL ModelView Projection Last Time
6
Today Review a bit from last time Work through some demos Introduce/demo windowing toolkits GLUT FLTK
7
OpenGL in Java UPDATE: Apparently, the newest versions of Netbeans include JOGL bindings Check out http://unc-cs575- lerch.blogspot.com http://unc-cs575- lerch.blogspot.com Many thanks to Tae
8
Clearing the Screen glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) To Clear The On-Screen Image And The Z-Buffer:
9
Our First OpenGL Code... glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush();... glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush();...
10
Drawing into a Window You specify what you want drawn with OpenGL But where are you drawing it? Need to call the OS to get a window Two ways to do this: 1. Make you learn the specifics of the operating / windowing system 2. Use a toolkit that hides the OS interface
11
UI Toolkits There are a lot of options to choose from: GLUT FLTK QT wxWindows Cocoa etc. I’m going to demonstrate GLUT today
12
GLUT OpenGL Utility Toolkit Cross-Platform C++ Drawing/UI Toolkit Provides functions to make starting up and drawing fast and easy Supports only limited user interfaces
13
Installing GLUT On Windows: Download from Nate Robins’ website: http://www.xmission.com/%7Enate/glut.ht ml http://www.xmission.com/%7Enate/glut.ht ml glut-3.7.6-bin has the dll/lib/header that are required Copy glut.dll to {Windows DLL dir}\glut32.dll Copy glut.lib to {VC++ lib path}\glut32.lib Copy glut.h to {VC++ include path}\GL\glut.h
14
Using GLUT Only need to include glut.h #include Automatically includes gl.h and glu.h Lighthouse3D has a good GLUT tutorial http://www.lighthouse3d.com/opengl/glut/ind ex.php?1 http://www.lighthouse3d.com/opengl/glut/ind ex.php?1
15
FLTK Fast Light Toolkit Cross-Platform C++ GUI Toolkit Provides more full-featured UI functionality than GLUT Also supports GLUT code through emulation Download from http://www.fltk.orghttp://www.fltk.org
16
Next Time Review of Assignment 1 Demo / discussion of Programming Assignment 1 Geometry & Modeling Will end early (~4:25) for Randy Pausch lecture
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.