• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 85  文章 - 47  trackbacks - 0

            常用鏈接

            隨筆分類

            隨筆檔案

            搜索

            •  

            最新評論

            First, think what you want these matrices do.
            Let we have transformation matrices A and B . We want to transform vector V by both and get vector V'.
            But above is not enough to specify what we want to do, as
            first transform by A then transform by B
            and
            first transform by B then transform by A
            are different. You can just try to play with rotations in real world.(get a cube, paint x,y,z on sides, etc.)

            Now, more on how it's done:

            first transform by A then transform by B
            It is easy to see that this is accomplished by:
            In openGL's convention:
            V'=B*(A*V)
            Note that it is same as
            V'=(B*A)*V
            so you can do it as
            C=B*A;
            V'=C*V;
            In DX's convention:
            V'=(V*A)*B
            C=A*B;
            V'=V*C;
            (note: real operations done on memory is the same. It's just matter how we map matrix indices to memory)
            As you see, V*A*B and B*A*V is kind of symmetrical. Same for consequently applied transforms like V*A*B*C*D*E*F or F*E*D*C*B*A*V

            Now, write it down for "transform by B then transform by A" yourself to remember it better.

            When you render something , you want points to be transformed by
            matrix of object
            matrix of parent object
            matrix of grandparent object ...
            matrix of camera
            (and done by API, projection matrix)
            From there you can find what order of multiplications you want. In OGL, you need to
            m=matrix_of_camera*matrix_of_grandparent_objectmatrix_of_parent object*matrix_of_object;
            ...
            then if you'll glLoadMatrix, OpenGL will do
            vertice=m*vertice;

            Some more notes: Let you have spacecraft with spacecraft-to-world matrix M
            And you use OpenGL convention.
            For example, to turn spacecraft around spacecraft's local X direction, you need to
            M=M*axis_angle_to_matrix(Vector(1,0,0),angle);
            (note: you need to reorthonormalize matrix if you do that incrementally)
            To turn spacecraft around global X direction, you need to
            M=axis_angle_to_matrix(Vector(1,0,0),angle)*M;


            On openGL:

            This sequence

            glMatrixMode(GL_MODELVIEW);
            glMultMatrix(A);
            glMultMatrix(B);
            glMultMatrix(C);
            ... render your mesh ...
            works as if your mesh would be transformed by C,then B, then A
            It makes lot of sense, if you for example want to render a robot with matrices giving positions of child nodes (fingers) relativelty to parent (arm), and arm are responsible for positioning fingers, you can do
            RenderArm(){
            glPushMatrix();
            glMultMatrix(matrix_of_first_finger);
            RenderFinger();
            glPopMatrix();
            glPushMatrix();
            glMultMatrix(matrix_of_second_finger);
            RenderFinger();
            glPopMatrix();
            }
            and so-on(simplified example)
            Then, you can have
            glPushMatrix();
            glMultMatrix(matrix_of_arm);
            RenderArm();
            glPopMatrix();

            and it will work properly.

            If you have more questions, ask.
            posted on 2008-04-30 22:05 w2001 閱讀(1401) 評論(2)  編輯 收藏 引用

            FeedBack:
            # re: OpenGL中的矩陣計算[未登錄] 2009-09-04 19:22 joe
            you english is really...bad...

            please write in chinese, that will be more helpful~  回復  更多評論
              
            # re: OpenGL中的矩陣計算 2009-09-09 19:31 w2001
            轉載,與本人水平無關。english止一工具耳,看得懂就達到目的了,至于badgood,說明不了任何問題。  回復  更多評論
              
            国产精品综合久久第一页| 国内精品伊人久久久影院| 青草国产精品久久久久久| 久久ww精品w免费人成| 精品久久人妻av中文字幕| 热久久国产精品| 午夜精品久久久内射近拍高清 | 办公室久久精品| 亚洲成av人片不卡无码久久| 亚洲综合熟女久久久30p| 久久99国产精品久久99果冻传媒 | 久久国产成人午夜AV影院| 久久影视综合亚洲| 一本久久知道综合久久| 久久国产精品99精品国产987| 日本国产精品久久| 波多野结衣中文字幕久久| 久久婷婷午色综合夜啪| 久久棈精品久久久久久噜噜| 久久人人爽人人爽人人片AV麻豆| 久久亚洲中文字幕精品有坂深雪| 久久最新免费视频| 91久久国产视频| 色欲综合久久中文字幕网| 思思久久99热免费精品6| 国产精品久久波多野结衣| 亚洲精品成人网久久久久久| AAA级久久久精品无码区| 青青草原精品99久久精品66| 一级A毛片免费观看久久精品| 国产精品九九久久免费视频| 久久成人精品视频| 国产成人综合久久综合| 精品久久久久久中文字幕| 久久精品国产亚洲av麻豆小说| 噜噜噜色噜噜噜久久| 久久精品国产亚洲AV不卡| 国内精品免费久久影院| 国产ww久久久久久久久久| 久久播电影网| 国产成人精品久久亚洲高清不卡 |