using gluLookAt() to create camera object


I am currently trying to do some basic camera tranformations using basic openGl calls such as gluLookAt() glPerspective and such.

Now what I noticed is that if I call any of those functions within the setup part of my testApp.cpp they dont seem to do anything. If I call them inside draw() they seem to work. Anyways calling all those functions each frame does not really seem to be effective.

Do I have to change all those things in the ofGraphics.cpp? or is there a way I can individually change it in my programs setup function?

Thanks in advance.


yes, that is because if you check the openframeworks sourcecode (app/ofAppGlutGlue.h -> void display(void)) you can see that the order is

  1. ofSetupScreen();
  2. OFSAptr->draw();
  3. glutSwapBuffers();

ofSetupScreen() sets the modelview- and the projection-matrix every time before the draw calls of your application. this procedure btw is needed every frame. if you want to implement a camera, then you should set it up (= setup the opengl matrices) before drawing everything else.

yeah. I just thought some calls might not be needed every frame. Anyways I did not see any performance issues with that so far. So I might just place it in the draw function.