[visionegg] Re: GL state responsibility (warning: may contain theory)

You are right about your assessment that stimuli positioning should be done this way:
-glPushMatrix()
-glTranslatef(position_of_stimulus)
-stimulus.draw()
-glPopMatrix()


This is what we have been thought in computer engineering classes at any rate. The positioning should be done in a hierarchical way when drawing multipart scenes. This is not currently the case with every stimulus calling glLoadIdentity().

Just wanted to contribute a little to the discussion.

You mention that you use the GL_PROJECTION matrix to point the camera? I'd be curious to know how you do it!

Bertrand

The modelview matrix state is an aspect that I just stumbled onto, and I found something somewhat worrisome.

http://www.opengl.org/resources/faq/technical/viewing.htm (section 8.030)
http://sjbaker.org/steve/omniv/projection_abuse.html

These both seem to say that all of the camera movements should be taking place in the modelview matrix and not the projection matrix. This came up when I started using my custom-made viewport that does the mapping for our screen. It involves several camera modifications to capture views at different perspectives. I put a Model3DS into the scene and put it on a circular path to make sure that it properly moves from camera to camera, only to find that it showed up in every camera at the same time.
I *think*, after preliminary analysis, that a simple yet tedious modification would fix this problem without modifying existing behaviour. I'm willing to put the time into making this modification assuming that it's deemed a legitimate concern. I think that if we were to modify every stimulus and remove the glLoadIdentity(), and then in the Viewport class wrap stimulus.draw() with a glPushMatrix() and glPopMatrix(), it would be possible to do everything as we are right now without having to modify the GL_PROJECTION matrix to point the camera.
Any thoughts? This may not be a complete analysis... I've just spent an hour or two tracing through (mostly my) code to figure out what the problem is. As I said before though, I'm not adverse to testing and fixing this problem myself. I've used the library a fair bit this summer already and I'd love to contribute back :)


Tony
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: