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.
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:
worldMatrix = inverse(cameraMatrix) * matrix
In view space:
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.