C++ (Qt)void Widget::paintGL(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); gluPerspective (30, 1, 1, 100); glTranslatef(0.0f, -0.75f, 0.0f); glRotatef(xRot1, 1.0f, 0.0f, 0.0f); glRotatef(yRot1, 0.0f, 1.0f, 0.0f); glRotatef(zRot1, 0.0f, 0.0f, 1.0f); glDeleteTextures(1, &textureID); textureID = bindTexture(QImage(camera1.getBuffer(), W, H, QImage::Format_ARGB32), GL_TEXTURE_2D); drawFigure(); glDeleteTextures(1, &textureID2); textureID2 = bindTexture(QImage(camera2.getBuffer(), W, H, QImage::Format_ARGB32), GL_TEXTURE_2D); drawFigure2(); glDeleteTextures(1, &textureID3); textureID3 = bindTexture(QImage(camera3.getBuffer(), W, H, QImage::Format_ARGB32), GL_TEXTURE_2D); drawFigure3(); glPopMatrix(); fps++; update();} void Widget::drawFigure(){ glVertexPointer(3, GL_FLOAT, 0, vecVertices.begin()); glTexCoordPointer(2, GL_FLOAT, 0, vecTextures.begin()); glDrawElements(GL_QUAD_STRIP, vecIndices.size(), GL_UNSIGNED_INT, vecIndices.begin());}
C++ (Qt)glGenTextures(1, &textureID);glBindTexture(GL_TEXTURE_2D, textureID);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);glTexImage2D(GL_TEXTURE_2D, 0, 3, WD, HD, 0, GL_RGBA, GL_UNSIGNED_BYTE, camera1.getBuffer());