Calculator
November 6th, 2006, 09:35 PM
Ahmahgawd! I think I get it! Edit: Only a half-eureka. Okay. So my problem was that my last way that each object thingy had a draw routine that did a glLoadIdentity, which messed up everything. So, now that I can't do that, how should I place things on my map? As in I do something like this:
std::vector<object>::iterator i = objects.begin();
std::vector<object>::iterator e = objects.end();
...
gluLookAt(0, 0, 1, 0, 0, 0, 0, 1, 0);
while(i != e)
{
i->draw();
i++;
}
But the thing is, I use translations, rotates, etc in my drawing routines to position the object and stuff. The thing is, now that I don't use glLoadIdentity, all those translations and stuff carry over through each things draw routine. One way I can think of fixing it, is doing that gluLookAt thing inside the draw routine, and use glLoadIdentity also, but this doesn't make all that much sense to me. Is there a better way, like a way to clear the matrices that translate and rotate the object around, without messing up the way I'm viewing things with gluLookAt?
std::vector<object>::iterator i = objects.begin();
std::vector<object>::iterator e = objects.end();
...
gluLookAt(0, 0, 1, 0, 0, 0, 0, 1, 0);
while(i != e)
{
i->draw();
i++;
}
But the thing is, I use translations, rotates, etc in my drawing routines to position the object and stuff. The thing is, now that I don't use glLoadIdentity, all those translations and stuff carry over through each things draw routine. One way I can think of fixing it, is doing that gluLookAt thing inside the draw routine, and use glLoadIdentity also, but this doesn't make all that much sense to me. Is there a better way, like a way to clear the matrices that translate and rotate the object around, without messing up the way I'm viewing things with gluLookAt?