• <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

            常用鏈接

            隨筆分類(lèi)

            隨筆檔案

            搜索

            •  

            最新評(píng)論

            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 閱讀(1402) 評(píng)論(2)  編輯 收藏 引用

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

            please write in chinese, that will be more helpful~  回復(fù)  更多評(píng)論
              
            # re: OpenGL中的矩陣計(jì)算 2009-09-09 19:31 w2001
            轉(zhuǎn)載,與本人水平無(wú)關(guān)。english止一工具耳,看得懂就達(dá)到目的了,至于badgood,說(shuō)明不了任何問(wèn)題。  回復(fù)  更多評(píng)論
              

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            久久精品毛片免费观看| 久久久久亚洲av无码专区导航| 色婷婷久久综合中文久久蜜桃av| 亚洲色大成网站WWW久久九九| 日韩欧美亚洲综合久久 | 久久精品无码专区免费东京热| 久久夜色精品国产噜噜麻豆| 久久久精品国产免大香伊| 精品一区二区久久久久久久网站| 久久精品国产男包| 无码专区久久综合久中文字幕| 久久久久亚洲AV无码专区网站| 伊人久久综合无码成人网| 性做久久久久久久| 国产激情久久久久影院小草| 久久精品日日躁夜夜躁欧美| 久久天堂电影网| 日本人妻丰满熟妇久久久久久| 精品久久久久久无码免费| 91精品国产高清91久久久久久| 国产成人久久AV免费| 人妻无码精品久久亚瑟影视| 久久这里只有精品18| 久久国产乱子伦精品免费午夜| 久久午夜福利电影| 久久久精品人妻一区二区三区蜜桃 | 国内精品久久久久影院薰衣草| 91精品国产91热久久久久福利| 国产精品久久网| 久久久久久久波多野结衣高潮| 一本久久免费视频| 久久综合伊人77777麻豆| 久久综合综合久久狠狠狠97色88| 久久久久女人精品毛片| 久久99九九国产免费看小说| 久久久久久噜噜精品免费直播| 91精品国产综合久久香蕉| 国产精品禁18久久久夂久 | 久久婷婷色香五月综合激情 | 久久五月精品中文字幕| 久久精品国产免费|