finding current position

Does opengl provide a way to find the current point with respect to the original frame? For
instance, in a routine to assemble a pipe system from its basic components, one may need
to keep track of branches’ points. Is it possible to find the current position after several
callings to gltranslatef() and glrotated()? I would really apreciate any help.

Thank you.

Let me understand.
You have something like
and you want the current position here?
The current position in work reference? In view space? relative to another (parent) node? Of with point?

In word reference:
glGetMatrix(GL_MODELVIEW_MATRIX, matrix);
worldMatrix = inverse(cameraMatrix) * matrix

In view space:
glGetMatrix(GL_MODELVIEW_MATRIX, matrix);

for a parent node just multiply the inverse of the parent matrix by the matrix you got from glgetmatrix

by the way… glGetMatrix is really slow, don’t use it, don’t use glTranslate and glRotate either, do your math by yourself and cache your matrix, it will be a lot faster.

There is the technique of using a deferred shader. It may be overkill, or it maybe what you want. In principle, you do the rendering in two steps (or more). You define a Framebuffer Object with several render targets. In those targets, you save information, like position, normals, lighting, etc. In the second stage, you render the result to the screen, accessing the previous render targets as bitmaps.

Regardless, consider to not use deprecated legacy OpenGL.

There is no such thing
glGetMatrix(GL_MODELVIEW_MATRIX, matrix);

Kopelrativ meant to say
Use glGetFloatv(GL_MODELVIEW_MATRIX, matrix);

which you can use.
Some people don’t realize this, but that is just matrix math which anyone can perform. In fact, it is better to use a math library

Sure, assuming your view position is 0,0,0 just multiply that point by the model view matrix

Thank you, I guess that’s what I need. Not sure I understood what the code glloadmatrix(cameraMatrix) does, Sorry, I’m not yet familiar with opengl coding!

Thank you for replying.