The Industry's Foundation for High Performance Graphics

1. Tetrahedron

Hello everyone.
Im not able to understand how the following is happening:

Code :
```void Tetrahedron()
{
glClear(GL_COLOR_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glScalef(scale, scale, scale);

Draw_Tetrahedron();
glFlush();

}

void Draw_Tetrahedron()
{
glPushMatrix();
glTranslatef(Tx, 0, 0);
glutWireTetrahedron();
glPopMatrix();

glPushMatrix();
glTranslatef(3.3 * Tx, 0, 0);
glutWireTetrahedron();
glPopMatrix();

}```

Now when i continuosly increase "scale" and redraw the tetrahedron,should'nt they overlap? Because im changing the scale factor, so how is that the same translation factor sufficing?

The tetrahedrons are not overlapping.They maintain the same distance between them in whatever way i change the size(i mean scale them).How is this happening?

Should i not give a larger translating factor when the objects are scaled to a larger extent?

Can anyone please explain?

2. Re: Tetrahedron

"Should i not give a larger translating factor when the objects are scaled to a larger extent?"

this would be true if you did no scale on Tetrahedron and this in Draw_Tetrahedron :
Code :
```void Draw_Tetrahedron()
{
glPushMatrix();
glTranslatef(Tx, 0, 0);
glScalef(scale, scale, scale);
glutWireTetrahedron();
glPopMatrix();

glPushMatrix();
glTranslatef(3.3 * Tx, 0, 0);
glScalef(scale, scale, scale);
glutWireTetrahedron();
glPopMatrix();

}```

3. Re: Tetrahedron

Thanks for the reply Zbuffer.
i got it.

One more thing.Is there any way we can get the Current Transformation Matrix?
ie since its a 4x4 matrix, can we retrive that matrix in any way?

4. Re: Tetrahedron

Use glGetDoublev with parameter GL_MODELVIEW_MATRIX

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•