Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void draw(EllipticParabola* ep) {
- glLineWidth(0.5f);
- // чтобы была заливка
- glPolygonMode(GL_FRONT_AND_BACK, cubeMode);
- // чтобы работал цвет в освещении
- glColorMaterial(GL_FRONT, GL_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
- //проходим по всем полигонам
- for (const std::vector<int>& pol : ep->polygons) {
- int i = 0;
- glBegin(GL_POLYGON);
- i = 0;
- // проходим по точкам в полигоне
- for (int ind : pol) {
- // индексы-хуиндексы
- ind *= 3;
- // цвет точки
- glColor3f(ep->points_color[ind], ep->points_color[ind + 1], ep->points_color[ind + 2]);
- // нормаль в точке
- glNormal3f(ep->points_normal[ind], ep->points_normal[ind + 1], ep->points_normal[ind + 2]);
- // точка
- glVertex3f(ep->points_pos[ind], ep->points_pos[ind + 1], ep->points_pos[ind + 2]);
- i++;
- }
- glEnd();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement