简体   繁体   中英

How to draw filled gl_quads Open_GL

So it's my first time working with OpenGL library and so far I have this code:

glColor3f(1, 0.1, 0.1);
glBegin(GL_QUADS);
glVertex2f(1.0, 1.0);
glVertex2f(0.3, 0.7);
glVertex2f(0.55, 0.45);
glVertex2f(1.0, 0.45);
glEnd();

It is drawing an empty "form" only with red edges, I want it filled with color inside as well. 在此处输入图片说明

The command you are looking for is

glPolygonMode(GL_FRONT, GL_FILL);

See https://www.opengl.org/sdk/docs/man2/xhtml/glPolygonMode.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM