Nested Transforms

Hi folks, I want to implement a nested transform shown in this video at Robot Movements from time 4:00 and above, where the user pulls the robot arm and all the attached meshes move with. I know this behavior can be achieved for example in Unity by creating nested game objects, but how is this possible in OpenGL? Is there any nice tutorial explaining this or does someone know the logical method? In general, I would like to add multiple coordinate systems in relation to the respective mesh like the video shows. That’s one of my goals. Thanks for help and hints.

There are two separate issues involved here.

The first is the use of transformation hierarchies. These are directly supported by “legacy” OpenGL (OpenGL 1/2, and the compatibility profile in later versions): most matrix operations concatenate a matrix with the current matrix, while glPushMatrix and glPopMatrix allow the current matrix to be saved and restored (which is necessary for branching hierarchies). This is described in chapter 3 of the red book (example 3-7 involves a robot arm). In “modern” OpenGL (3+ core profile, ES 2+), the concept remains the same but generating matrices is the responsibility of the application code. GLM provides matrix/vector types and various utility functions, including work-alikes for deprecated/removed OpenGL functions.

The second issue is inverse kinematics (IK). With a transformation hierarchy, the parameters are the rotations at each joint; the position of any point in the structure is determined by the transformations which affect it. IK is essentially the process of determining the rotations which are required to move a particular point on the structure to a particular point in space. This is an under-determined problem, i.e. there are (usually) many valid solutions. So any practical IK system needs additional rules to decide the “best” solution, and those depend upon what you’re trying to model. OpenGL (legacy or modern) doesn’t have any explicit support for IK; it’s up to the application to calculate the rotations.

This is described in chapter 3 of the red book (example 3-7 involves a robot arm).

Thank you for help. Really, I have purchased the new edition of the red book, but I am reading at present the real-time rendering book to learn basic and advanced concepts like mesh selection (line-plane intersection, etc.) and movement. By the way, I can highly recommend this book which teaches CG in depth from the beginning. In my opinion, it is the best one on the market especially the new version. In addition, I am about to create my own 3D math library because GLM is implemented using templates and on the other, I think it is better to understand the things behind the scene by implementing your own code. I will look in chapter 3 of the red book for the transformation hierarchies and search about IK to get used to. I was wondering how this behavior gets implemented in OpenGL that’s why I have asked now.