开发者

How can I draw the following figure in opengl?

I need to draw the following figure in openGL.

How can I draw the following figure in opengl?

I tried to do that with polygons like this

glTexCoord2f(0.0f, 0.0f);glVertex3f(9.5f,0,-20);
glTexCoord2f(0.5f, 0.0f);glVertex3f(20,0,-20);
glTexCoord2f(0.0f, 1.0f);glVertex3f(20,0,40);
glTexCoord2f(1.0f, 0.0f);glVertex3f(9.5f,0,40);



glTexCoord2f(0.0f, 0.0f开发者_Python百科);glVertex3f(9.5f,0,40);
glTexCoord2f(1.0f, 0.0f);glVertex3f(-20,0,40);
glTexCoord2f(0.0f, 1.0f);glVertex3f(-20,0,0);
glTexCoord2f(1.0f, 0.0f);glVertex3f(-3.5f,0,0);
glTexCoord2f(1.0f, 1.0f);glVertex3f(9.5f,0,0);

I didn't get the exact figure, I got the following figure:

How can I draw the following figure in opengl?

can anyone help??


Triangulate your input polygon and render the resulting triangles. GL_POLYGON only works on convex polygons.

Alternatively you can use the stencil buffer to render concave polygons.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜