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

    <tfoot id='B9c3b'></tfoot>
    <legend id='B9c3b'><style id='B9c3b'><dir id='B9c3b'><q id='B9c3b'></q></dir></style></legend>
  1. <small id='B9c3b'></small><noframes id='B9c3b'>

      <bdo id='B9c3b'></bdo><ul id='B9c3b'></ul>
    1. OpenGL GL_POLYGON 凹多边形不着色

      时间:2023-09-18
    2. <legend id='TPBGh'><style id='TPBGh'><dir id='TPBGh'><q id='TPBGh'></q></dir></style></legend>
          1. <tfoot id='TPBGh'></tfoot>

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

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

                本文介绍了OpenGL GL_POLYGON 凹多边形不着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                当我尝试在 OpenGL 中使用多边形时遇到问题.我不知道如何解释这一点,但我所有的顶点都与开始的顶点相连.当我尝试为对象着色时会出现问题.我想画一个简单的对象.

                I have a problem when I try to use Polygon in OpenGL. I don't know how to explain this but all my vertices are connected with the beginning one. The problem happens when I try to color the object. I want to draw a simple object.

                void TOP (float x1, float y1, float x2, float h,float n)
                {
                  float r = x2-x1;
                  if(n==1){glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);} // FOR FILL OR NO FILL OBJECT
                  glBegin(GL_POLYGON);
                     glVertex2f(x1,y1);
                     glVertex2f(x2,y1);
                     glVertex2f(x2,y1+h/7);
                     y1=y1+h/7;
                     glVertex2f(x2-r/5,y1+h/7);
                     x2=x2-r/5; y1=y1+h/7;
                     glVertex2f(x2,y1+2*h/7);
                     y1=y1+2*h/7;
                      glVertex2f(x2+r/5,y1+h/7);
                      y1=y1+h/7; x2=x2+r/5;
                      glVertex2f(x2,y1+2*h/7);
                cout<<y1<<endl;
                      y1=y1+2*h/7;
                       glVertex2f(x2-r/5,y1); x2=x2-r/5;
                      glVertex2f(x2,y1-h/7); y1=y1-h/7;
                      glVertex2f(x2-r/5,y1);x2=x2-r/5;
                      glVertex2f(x2,y1+h/7); y1=y1+h/7;
                      glVertex2f(x2-r/5,y1);x2=x2-r/5;
                
                       glVertex2f(x2,y1-h/7); y1=y1-h/7;
                       glVertex2f(x2-r/5,y1);x2=x2-r/5;
                        glVertex2f(x2,y1+h/7); y1=y1+h/7;
                         glVertex2f(x2-r/5,y1);x2=x2-r/5;
                         glVertex2f(x2,y1-2*h/7);y1=y1-2*h/7;
                         glVertex2f(x2+r/5,y1-h/7);y1=y1-h/7; x2=x2+r/5;
                         glVertex2f(x2,y1-2*h/7); y1=y1-2*h/7;
                         glVertex2f(x2-r/5,y1-h/7); y1=y1-h/7;x2=x2-r/5;
                          glVertex2f(x2,y1-h/7);
                
                  glEnd();
                }
                

                输出:

                推荐答案

                GL_POLYGON 仅适用于 凸多边形一个>:

                GL_POLYGON:绘制单个凸多边形.顶点 1N 定义了这个多边形.

                GL_POLYGON: Draws a single, convex polygon. Vertices 1 through N define this polygon.

                对于凹多边形,您至少有两个选择:

                For concave polygons you have at least two options:

                1. 对多边形进行三角剖分并使用GL_TRIANGLES.

                使用模板缓冲技巧.

                这篇关于OpenGL GL_POLYGON 凹多边形不着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:带有 std::vector 的 VBO 下一篇:C/C++ 中 OpenGL 着色器的简单框架

                相关文章

                最新文章

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

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

                      <bdo id='vmYWI'></bdo><ul id='vmYWI'></ul>
                    <legend id='vmYWI'><style id='vmYWI'><dir id='vmYWI'><q id='vmYWI'></q></dir></style></legend>

                    <tfoot id='vmYWI'></tfoot>