Need draw a hollow rectangle in opengl and i try this using primitive objects:
void Skin::draw()
{
glColor4f(1.0, 1.0, 1.0, 1.0);
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(-0.8, -0.86, 0); // XYZ left, top
glVertex3f(-0.7, -0.86, 0); // XYZ right, top
glVertex3f(-0.7, -0.96, 0); // XYZ right, bottom
glVertex3f(-0.8, -0.96, 0); // XYZ left, bottom
glVertex3f(-0.8, -0.86, 0); // XYZ left, top (close)
glVertex3f(-0.79, -0.87, 0); // XYZ left, top (diagonal down-right)
glVertex3f(-0.79, -0.95, 0); // XYZ left, bottom
glVertex3f(-0.71, -0.95, 0); // XYZ right, bottom
glVertex3f(-0.71, -0.87, 0); // XYZ right, top
glVertex3f(-0.79, -0.87, 0); // XYZ left, top (close)
glVertex3f(-0.8, -0.86, 0); // XYZ left, top (close diagonal top-left)
glEnd();
}
Bug the result is a fill rectangle :(
Aucun commentaire:
Enregistrer un commentaire