1. <i id='DjYrl'><tr id='DjYrl'><dt id='DjYrl'><q id='DjYrl'><span id='DjYrl'><b id='DjYrl'><form id='DjYrl'><ins id='DjYrl'></ins><ul id='DjYrl'></ul><sub id='DjYrl'></sub></form><legend id='DjYrl'></legend><bdo id='DjYrl'><pre id='DjYrl'><center id='DjYrl'></center></pre></bdo></b><th id='DjYrl'></th></span></q></dt></tr></i><div id='DjYrl'><tfoot id='DjYrl'></tfoot><dl id='DjYrl'><fieldset id='DjYrl'></fieldset></dl></div>

    <small id='DjYrl'></small><noframes id='DjYrl'>

      <legend id='DjYrl'><style id='DjYrl'><dir id='DjYrl'><q id='DjYrl'></q></dir></style></legend>
      <tfoot id='DjYrl'></tfoot>
      • <bdo id='DjYrl'></bdo><ul id='DjYrl'></ul>

      使用 opengl 进行真正的等距投影

      时间:2023-09-18
    1. <small id='79ziV'></small><noframes id='79ziV'>

          <tbody id='79ziV'></tbody>

        <legend id='79ziV'><style id='79ziV'><dir id='79ziV'><q id='79ziV'></q></dir></style></legend>
          <i id='79ziV'><tr id='79ziV'><dt id='79ziV'><q id='79ziV'><span id='79ziV'><b id='79ziV'><form id='79ziV'><ins id='79ziV'></ins><ul id='79ziV'></ul><sub id='79ziV'></sub></form><legend id='79ziV'></legend><bdo id='79ziV'><pre id='79ziV'><center id='79ziV'></center></pre></bdo></b><th id='79ziV'></th></span></q></dt></tr></i><div id='79ziV'><tfoot id='79ziV'></tfoot><dl id='79ziV'><fieldset id='79ziV'></fieldset></dl></div>

        • <tfoot id='79ziV'></tfoot>
          • <bdo id='79ziV'></bdo><ul id='79ziV'></ul>

              • 本文介绍了使用 opengl 进行真正的等距投影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                I am a newbie in OpenGL programming with C++ and not very good at mathematics. Is there a simple way to have isometric projection?

                I mean the true isometric projection, not the general orthogonal projection.

                (Isometric projection happens only when projections of unit X, Y and Z vectors are equally long and angles between them are exactly 120 degrees.)

                Code snippets are highly appreciated..

                解决方案

                Try using gluLookAt

                glClearColor(0.0, 0.0, 0.0, 1.0);
                glClear(GL_COLOR_BUFFER_BIT);
                
                glMatrixMode(GL_PROJECTION);
                glLoadIdentity();
                
                /* use this length so that camera is 1 unit away from origin */
                double dist = sqrt(1 / 3.0);
                
                gluLookAt(dist, dist, dist,  /* position of camera */
                          0.0,  0.0,  0.0,   /* where camera is pointing at */
                          0.0,  1.0,  0.0);  /* which direction is up */
                glMatrixMode(GL_MODELVIEW);
                
                glBegin(GL_LINES);
                
                glColor3d(1.0, 0.0, 0.0);
                glVertex3d(0.0, 0.0, 0.0);
                glVertex3d(1.0, 0.0, 0.0);
                
                glColor3d(0.0, 1.0, 0.0);
                glVertex3d(0.0, 0.0, 0.0);
                glVertex3d(0.0, 1.0, 0.0);
                
                glColor3d(0.0, 0.0, 1.0);
                glVertex3d(0.0, 0.0, 0.0);
                glVertex3d(0.0, 0.0, 1.0);
                
                glEnd();
                
                glFlush();
                

                Results in

                We can draw a cube to check that parallel lines are indeed parallel

                glPushMatrix();
                glTranslated(0.5, 0.5, 0.5);
                glColor3d(0.5, 0.5, 0.5);
                glutWireCube(1);
                glPopMatrix();
                

                这篇关于使用 opengl 进行真正的等距投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在OpenGL中截取屏幕截图 下一篇:多边形轮廓上的边缘并不总是正确的

                相关文章

                最新文章

              • <tfoot id='kcmjG'></tfoot>

                  <bdo id='kcmjG'></bdo><ul id='kcmjG'></ul>

              • <i id='kcmjG'><tr id='kcmjG'><dt id='kcmjG'><q id='kcmjG'><span id='kcmjG'><b id='kcmjG'><form id='kcmjG'><ins id='kcmjG'></ins><ul id='kcmjG'></ul><sub id='kcmjG'></sub></form><legend id='kcmjG'></legend><bdo id='kcmjG'><pre id='kcmjG'><center id='kcmjG'></center></pre></bdo></b><th id='kcmjG'></th></span></q></dt></tr></i><div id='kcmjG'><tfoot id='kcmjG'></tfoot><dl id='kcmjG'><fieldset id='kcmjG'></fieldset></dl></div>
                <legend id='kcmjG'><style id='kcmjG'><dir id='kcmjG'><q id='kcmjG'></q></dir></style></legend>

                    <small id='kcmjG'></small><noframes id='kcmjG'>