Browse Source

begin face normal

develop
Robin Thoni 7 years ago
parent
commit
84c7334fe0
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      TheGame/openglrenderdevice.cpp

+ 7
- 0
TheGame/openglrenderdevice.cpp View File

117
 {
117
 {
118
     _width = width;
118
     _width = width;
119
     _height = height;
119
     _height = height;
120
+//    glViewport(0, 0, _width, _height);
120
     int side = qMin(_width, _height);
121
     int side = qMin(_width, _height);
121
     glViewport((_width - side) / 2, (_height - side) / 2, side, side);
122
     glViewport((_width - side) / 2, (_height - side) / 2, side, side);
122
 }
123
 }
164
 void OpenGLRenderDevice::drawPolygon(const QList<ColorVector3D> &points)
165
 void OpenGLRenderDevice::drawPolygon(const QList<ColorVector3D> &points)
165
 {
166
 {
166
     glBegin(GL_POLYGON);
167
     glBegin(GL_POLYGON);
168
+    Vector3D p1 = points[0];
169
+//    Vector3D p2 = points[1];
170
+//    Vector3D n = p1.crossProduct(p2);
171
+//    Vector3D n2 = p2.crossProduct(p1);
172
+//    qDebug() << n.getX() << n.getY() << n.getZ() << n2.getX() << n2.getY() << n2.getZ();
173
+//    glNormal3d(n.getX(), n.getY(), n.getZ());
167
     for (int i = 0; i < points.size(); ++i) {
174
     for (int i = 0; i < points.size(); ++i) {
168
         drawVertex(points[i]);
175
         drawVertex(points[i]);
169
     }
176
     }

Loading…
Cancel
Save