Potential bug?

I’m not sure if this is a bug in the code, but I ran across something that might cause problems for people.

In ofGraphics.cpp (line 411-417), in the matrix multiplications:

  
	  
glMatrixMode(GL_PROJECTION);  
glLoadIdentity();  
gluPerspective(screenFov, aspect, nearDist, farDist);  
gluLookAt(eyeX, eyeY, dist,  
               eyeX, eyeY, 0.0, 0.0, 1.0, 0.0);  
glMatrixMode(GL_MODELVIEW);  
glLoadIdentity();  
  

I believe that the gluLookAt(…) should be multiplied with the model view matrix, not the projection matrix (make it the last function call in this block). I only stumbled upon this because I’m trying to use openFrameworks with a cluster graphics library called CGLX and I discovered my screen was blank. I traced my problem to this line and thought I should let everyone know in case it really is a bug.

So here is the new block with what I changed… nothing drastic.

  
  
glMatrixMode(GL_PROJECTION);  
glLoadIdentity();  
gluPerspective(screenFov, aspect, nearDist, farDist);  
glMatrixMode(GL_MODELVIEW);  
glLoadIdentity();  
gluLookAt(eyeX, eyeY, dist,  
               eyeX, eyeY, 0.0, 0.0, 1.0, 0.0);  
  

I know it’s obscure but I hope it helps someone out there! =)

You’re correct, infact it’s mentioned specifically in this OGL Faq.

http://www.opengl.org/resources/faq/technical/viewing.htm

number 8.030

Hey, that CGLX looks really interesting…

hey thanks for the bug report - it looks a simple fix, and it’s very useful to post. we’ll test the fix in the next release.

I just saw that wall of lcd screens at calit/ucsd, and was wondering how to possibly make content for it. now it makes alot of sense, and I’m interested to check out CGLX more :slight_smile:

thanks!
zach

@Dingobloo: Thanks! I’m glad I posted it then. =) I’ve been running my version of OF with that fix and I haven’t seen any problems yet.

@arturo: It is! You can get more info here: http://vis.ucsd.edu/~cglx/

@zach: Yeah, I’m actually trying to develop software in OF to use with the CalIT tile wall. I’ve had to do a lot of modification to the OF core code since CGLX doesn’t do everything exactly like OpenGL, but I’m doing it all with #defines. I’ll update you guys when things get a bit more interesting with it.