# is there a way to find out what coordinate we r in

To my knowledge, the glLoadIdentity function brings us back to the coordinate 0,0,0 to draw on am i correct?

If we have done a series of translations and so on, how do we find out the current coordinate we are going to draw on? for example after a series of translations, creating objects and so on, we could be on (4,-1,43).

To my knowledge, the glLoadIdentity function brings us back to the coordinate 0,0,0 to draw on am i correct?

glLoadIdentity replaces the current matrix with an identity matrix. What that means depends on what the current matrix is. If it is GL_MODELVIEW, then the current coordinate system will be eye-space: relative to the camera.

You sound like someone who has cobbled together bits of code from different places, and now are trying to figure out what all of these different calls mean without any real context. My suggestion is to start with this. It uses shaders rather than fixed-function code, but all of the stuff I talk about with matrix stacks and so forth is equivalent to fixed-function matrix calls.

If we have done a series of translations and so on, how do we find out the current coordinate we are going to draw on?

I’d be more concerned with why you don’t know what the current “coordinate” is. You did build the transformation matrix, yes?

yes but first it is creating a terrain landscape. after that i wish to draw an object on the surface. now once the terrain landscape is created, i immediately draw an object and it is approximately in the middle of the surface. thats okay, but since i will be drawing objects that move, i need to do it from the origin. eg create an object at origin, then translate it to one spot, then translate again and again for each frame so we can see movement.

but right now, if i try glLoadIdentity, and then create the object, i cannot see it on the terrain. So I have to not use glLoadIdentity in order to see it on the landscape. So I wish to know where I currently am about to draw, so i can translate from the origin to somewhere there.

See, I was kinda hoping that you would actually read the page I linked you to, since it explains in excruciating detail how this is all supposed to work. That’s one of the reasons why I wrote it; so that I could link people to an explanation rather than having to explain the same concepts over and over again.

Your basic problem is that you don’t understand transformations, spaces, and matrix stacks. Therefore, you are unable to effectively use OpenGL’s matrix functions. Occasionally, you stumble onto a series of function calls that causes something not entirely unlike what you want to happen. But because it’s completely by accident, you don’t really understand what’s going on.

For example, if I told you how to get the current position of the current transformation matrix, you would use it and jury-rig something that would make things “work”. Then you would try to implement a moving camera, and everything would immediately break again. Without that foundation of knowledge about what you’re doing, there’s no way for you to be able to diagnose your problems, so you’d just show up a few hours later, asking another question.

I know a long page of text is intimidating. But you simply don’t know enough yet for any answers anyone might give you to be useful. So I implore you to learn about how transformations work.

okay, i understand your frustration completely. but i dont have much time. All I know is this, I have created a simple landscape. Then I the following code occurs:

glTranslatef(0.0f, 0.0f, 0.0f);
glutSolidSphere (1, 20, 20);

glTranslatef(8.0f, 0.0f, 0.0f);
glutSolidSphere (1, 20, 20);

It works, I can see the two spheres perfectly. But I want to know where in the coordinate system they are positioned. If I tried doing a glLoadIdentity() before each glTranslateef, and adjusted the glTranslatef to where i THINK the middle of the landscape is, it does not work. So I am trying to find out where I am. I know where the terrain corners are theoretically, and it should be the same im practice, but it doesnt seem to be the case. So if you could tell me how I could find out what coordinate i am currently on, I could try and work my way from there so I can understand whats goin on.