# Hello World! - And the first issues just in time...

Hello to the Forum!

To give you a short introduction of mine - my name is Hansjoerg and I’m from southern Germany , and I’m trying to dig into the basics of 3 D programming with hobby background.

Last month, I built a little ( yes I’m a mechatronics and totally no software guy) model of an industrial handling robot. Now I decided to setup an parallel virtual machine space model using a IK / stacked systems transformation - and as I don’t have any access to commercial tools and mainly for the purpose of learning, I want to do my own program using OPENGL. I already found an example of a rotating pyramid on the web which I used for a first attempt of learning, but since I wanted to change the perspective of view using GLULOOKAT() I got stuck. - The line of code is - after my opinion- placed right in the display routine before any other transformation. But it is just ignored … Could you give me any hint about how to achieve the right behaviour ???

I attached the code sequence below!

Thanks in advance for your help!

Hansjoerg

void display() {

``````glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers
glMatrixMode(GL_MODELVIEW);     // To operate on model-view matrix

gluLookAt(50, 50, 50, 0, 0, 0, 0, 1, 0);

//KJ1
glLoadIdentity();                  // Reset the model-view matrix
glTranslatef( 0.0f,   0.0f,   0.0f);  // Move left and into the screen
glRotatef(AngleJ1,   0.0f,  1.0f,   0.0f);  // Rotate about the (1,1,0)-axis [NEW]

glBegin(GL_TRIANGLES);           // Begin drawing the pyramid with 4 triangles
// Front KJ1
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( 0.0f,   heightKJ1,  0.0f);
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( -edgeKJ1 / 2,   0.0f,  edgeKJ1 / 2);
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( edgeKJ1 / 2,   0.0f,  edgeKJ1 / 2);

// Right KJ1
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( 0.0f,  heightKJ1,   0.0f);
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( edgeKJ1 / 2,   0.0f,   edgeKJ1 / 2);
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( edgeKJ1 / 2,   0.0f,  -edgeKJ1 / 2);

// Back KJ1
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( 0.0f,  heightKJ1,   0.0f);
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( edgeKJ1 / 2,   0.0f,   -edgeKJ1 / 2);
glColor3f(0.8f, 0.0f, 0.0f);
glVertex3f( -edgeKJ1 / 2,   0.0f,   -edgeKJ1 / 2);

// Left KJ1
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( 0.0f,   heightKJ1,   0.0f);
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( -edgeKJ1 / 2,   0.0f,  -edgeKJ1 / 2);
glColor3f(0.5f, 0.0f, 0.0f);
glVertex3f( -edgeKJ1 / 2,   0.0f,  edgeKJ1 / 2);
glEnd();   // Done drawing the pyramid

glutSwapBuffers();  // Swap the front and back frame buffers (double buffering)

// Update the rotational angle after each refresh [NEW]
AngleJ1 += 0.2f;

}``````

You need to clear the MODELVIEW to the identity before you call gluLookAt(). gluLookAt() multiplies a new transform on top of the then-current MODELVIEW matrix stack.

Great - just moving up the GLloadidentity() two lines? Thank you very much!

I would have right another question: Having a 5+ Axis device -> here is a short clip of what I’m talking about

https://www.youtube.com/watch?v=evt_9DVsy2g

I would now like to stack the coordinate systems of my single limbs
in the way of IK so a parent limb affects all following children, but not vice versa.

-I understood, that I must reset the identity only once, since I do not want to change the world system due to the transformations I must perform to move the limbs to their locations.

Setting up the IK structure I would start at the absolute parent and add sequently children by translating them to the relative parent limbs end, by translating coordinates which refer to the origin of the previous translation ? -Right? so e.g. of my parent limb starts at (0,1,0) and ends at (0,1,-5) ( and the start coords is the point of the recent translation) I just would have to translate the child limb by the vector (0,0,-5)?

Sorry about the dumb question, but I’m at the VERY beginning of understanding OPENGL …

BR Hansjoerg

… Got it working… Thanks for the kind support!

Hello community!

After my first attemps in Open GL programming came out really great, I now have an IK model of my 5 Axis handling Robot ( 5 stacked coords systems)

I now want to visually trace the tooltip using a polyline chronologically connecting all positions the tooltip reached while following its toolpath

• How could I allocate a point in space ( referenced to the world coordinatesystem - if possible without any backtransformation via the 5 stacked subsystems )

I want to achieve the white line in the picture below

[ATTACH=CONFIG]1218[/ATTACH]

Thank you for any hint!

Hansjoerg

Have you been able to solve this problem yet? If not, post your code.
If it runs on my system and is clean enough, I’ll take a look at it.