/var/spool/weblog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Geek News del.icio.us bookmarks RSS |
Fri, Mar 31, 2006
GLIntercept
Here's a 30-second walkthrough:
glClearColor(0.000000,0.000000,0.000000,0.000000) wglGetCurrentContext()=0x10000 wglGetCurrentDC()=0xb70114f8 wglGetCurrentContext()=0x10000 wglGetCurrentDC()=0xb70114f8 glViewport(0,0,600,300) glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(0.000000,2.000000,0.000000,1.000000,-1.000000,1.000000) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glClear(GL_COLOR_BUFFER_BIT) glColor3f(1.000000,1.000000,0.000000) glBegin(GL_LINES) glVertex3f(1.000000,0.000000,0.000000) glVertex3f(1.000000,1.000000,0.000000) glEnd() glViewport(300,0,300,300) glMatrixMode(GL_PROJECTION) glLoadIdentity() glFrustum(-1.500000,1.500000,-1.500000,1.500000,2.000000,8.000000) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glMultMatrixf([1.000000,0.000000,0.000000,0.000000, 0.000000,1.000000,0.000000,0.000000, 0.000000,0.000000,1.000000,0.000000, 0.000000,0.000000,0.000000,1.000000]) glTranslated(0.000000,0.000000,-6.500000) glPushMatrix() glPushMatrix() glColor3f(1.000000,0.000000,0.000000) glBegin(GL_LINE_LOOP) glNormal3fv([0.000000,0.000000,-1.000000]) glVertex3fv([0.500000,0.500000,-0.500000]) glVertex3fv([0.500000,-0.500000,-0.500000]) glVertex3fv([-0.500000,-0.500000,-0.500000]) glVertex3fv([-0.500000,0.500000,-0.500000]) glEnd()Running with gliConfig_FullDebug.ini also makes sure that every call to an OpenGL function is checked with glGetError(), which will catch things like passing bad values to functions or trying to pop the matrix stack more times that it's been pushed. To make the best use of a tool like this, you'll probably want a utility to tail the log as your program is running. (I'm told there are also GUI versions). Note that you don't need access to the source code -- if you have a game at home that uses OpenGL, you can watch what it's doing, too. (Just don't steal their code, and don't tell them I'm the one who told you how.) GLIntercept has a few more tricks up its sleeve, but I'll leave it up to you to read about them. For Linux people, there's a similar program called BuGLe, but I haven't tried it. And, of course, we smug OS X weenies have the OpenGL Profiler. For those of you using Igloo, I've put together a new debug package that includes GLIntercept and Windows port of GNU tail. I'm not entirely sure about the legality of all this -- GLIntercept and GNU tail are available under the GNU General Public license, but EiC is still MIA. /var/spool/courses/csuf/2006/spring/cpsc465 # |
Topics
Archives
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||