Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Tetrahedron

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2010
    Posts
    209

    Tetrahedron

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

    Code :
    void Tetrahedron()
    {
    	glClear(GL_COLOR_BUFFER_BIT);
     
    	glMatrixMode(GL_MODELVIEW);
    	glLoadIdentity();
    	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?

    Thanks in advance.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    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. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2010
    Posts
    209

    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. #4
    Intern Contributor
    Join Date
    Oct 2009
    Posts
    58

    Re: Tetrahedron

    Use glGetDoublev with parameter GL_MODELVIEW_MATRIX
    ----
    Antares game blog: http://antaresgame.blogspot.com/

Posting Permissions

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