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,6 +117,7 @@ void OpenGLRenderDevice::resize(int width, int height)
117 117
 {
118 118
     _width = width;
119 119
     _height = height;
120
+//    glViewport(0, 0, _width, _height);
120 121
     int side = qMin(_width, _height);
121 122
     glViewport((_width - side) / 2, (_height - side) / 2, side, side);
122 123
 }
@@ -164,6 +165,12 @@ void OpenGLRenderDevice::drawLine(const ColorVector3D &begin, const ColorVector3
164 165
 void OpenGLRenderDevice::drawPolygon(const QList<ColorVector3D> &points)
165 166
 {
166 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 174
     for (int i = 0; i < points.size(); ++i) {
168 175
         drawVertex(points[i]);
169 176
     }

Loading…
Cancel
Save