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 2 of 2

Thread: How to Perform a Composite Concatenation [Transformation] Through Code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Newbie Newbie
    Join Date
    Nov 2017
    Posts
    2

    How to Perform a Composite Concatenation [Transformation] Through Code

    using C++ , OpenGL , and Visual Studio 2013 IDE

    Code :
    void drawSquare(){
    	glBegin(GL_QUADS);   //Primitive
    	glVertex2i(200, 100);//vertices for points(coordinates)
    	glVertex2i(250, 100);
    	glVertex2i(250, 150);
    	glVertex2i(200, 150);
    	glEnd();
     
    }

    Code :
    void myDisplay(void)
    {
    	glClear(GL_COLOR_BUFFER_BIT);
    	drawSquare();
    	glTranslatef(1.5, 1.5, 0);
    	drawSquare();
    	glScalef(0.3, 0.3, 0);
    	drawSquare();
    	glRotatef(45, 0, 0, 1);
    	drawSquare();
    	glFlush();   //Set all output to display
    }
    does this code perform composite concatenation ?



    Question

    Build a transformation that
    a) Rotate through 45 deg [M1]
    b) Scale in X By 1.5 and in Y By -2 [M2]
    c) Translate Through (3,5) [M3]

    Find the image under this transofrmation of the point (1,2)


    so we will work backwards and first apply part c then part b then part a

    i.e M3 * M2 * M1

    Step-1

    Click image for larger version. 

Name:	1.jpg 
Views:	12 
Size:	13.3 KB 
ID:	2541


    Step-2

    Click image for larger version. 

Name:	2.jpg 
Views:	11 
Size:	9.3 KB 
ID:	2542


    i understood the process of Composite Concatenation

    what i dont understand is how to perform a composite concatenation through program code ?

    consider the code i posted at the very beginning

    it calls

    drawSquare
    glRotate
    drawSquare
    glTranslate
    drawSquare


    is this composite concatenation ?

    how do i use the final generated Matrix (Qx,Qy,1) and use it to perform composite concatenation
    Last edited by umartariq; 11-07-2017 at 01:25 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,155
    Quote Originally Posted by umartariq View Post
    does this code perform composite concatenation ?
    ...
    i understood the process of Composite Concatenation
    what i dont understand is how to perform a composite concatenation through program code ?
    Websearch glTranslatef and glRotatef and read the manual pages. They'll tell you the answer.

    For other related reading, websearch 'Composite Concatenation opengl'.

Posting Permissions

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