使用单个GL_TRIANGLE_STRIP

时间:2015-11-25 22:44:53

标签: opengl

这可能吗? (我知道,但是我不能这样做。)

void drawScene(void)
{  

   glClear(GL_COLOR_BUFFER_BIT);
   glColor3f(0.0, 0.0, 0.0);
   if (isWire) 
       glPolygonMode(GL_FRONT, GL_LINE);
   else
   glPolygonMode(GL_FRONT, GL_FILL);

   glBegin(GL_TRIANGLE_STRIP);
   glVertex3f(10,10,0);
   glVertex3f(20,10,0);

   glVertex3f(30,80,0);
   glVertex3f(40,70,0);

   glVertex3f(50,80,0);
   glVertex3f(60,10,0);

   glVertex3f(70,10,0);
   glEnd();

   glBegin(GL_TRIANGLE_STRIP);

   glEnd();

   glFlush();
}

有我的尝试,虽然我的下一个想法是桥接A的腿。但我想在一个单独的条带。

1 个答案:

答案 0 :(得分:2)

enter image description here

在朋友几何的帮助下:)

void drawScene(void)
{  

   glClear(GL_COLOR_BUFFER_BIT);
   glColor3f(0.0, 0.0, 0.0);
   if (isWire) 
       glPolygonMode(GL_FRONT, GL_LINE);
   else
   glPolygonMode(GL_FRONT, GL_FILL);

     // Draw a triangle strip.
   glBegin(GL_TRIANGLE_STRIP);
      glVertex3f(10.0, 10.0, 0.0);
  glVertex3f(20.0, 10.0, 0.0);
  glVertex3f(12.0, 30.0, 0.0);
  glVertex3f(22.0, 30.0, 0.0);
  glVertex3f(17.0, 80.0, 0.0);
  glVertex3f(26.0, 70.0, 0.0);
  glVertex3f(35.0, 80.0, 0.0);
  glVertex3f(31.0, 40.0, 0.0);
  glVertex3f(42.0, 35.0, 0.0);
  glVertex3f(23.0, 40.0, 0.0);
  glVertex3f(25.0, 35.0, 0.0);
  glVertex3f(21.9, 30.0,0.0); 

  glVertex3f(42.0, 35.0, 0.0);
  glVertex3f(32.0, 30.0, 0.0);
  glVertex3f(46.0, 10.0, 0.0);
  glVertex3f(36.5, 10.0, 0.0);
   glEnd();


   glFlush();
}