【发布时间】:2014-07-08 03:28:58
【问题描述】:
我复制了this script (pasted below) 并运行了它。不幸的是,图像出现混乱,如下所示。谁能帮我摆脱它?
配置:
- Ubuntu 13.10
- pyopengl 3.0.1b1
- 显卡 AMD Radeon HD 6650M
-
OpenGL 版本字符串:3.0 Mesa 10.3.0-devel (git-32c5544 saucy-oibaf-ppa)
from OpenGL.GL import * from PyQt4 import QtGui from PyQt4.QtOpenGL import * class WfWidget(QGLWidget): def __init__(self, parent = None): super(WfWidget, self).__init__(parent) def paintGL(self): glClearColor(0,0,0,0) glColor3f(0.0, 0.0, 1.0) glRectf(-5, -5, 5, 5) glColor3f(1.0, 0.0, 0.0) glBegin(GL_LINES) glVertex3f(0, 0, 0) glVertex3f(20, 20, 0) glEnd() def resizeGL(self, w, h): glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(-50, 50, -50, 50, -50.0, 50.0) glViewport(0, 0, w, h) def initializeGL(self): glClearColor(0.0, 0.0, 0.0, 1.0) glClear(GL_COLOR_BUFFER_BIT) if __name__ == '__main__': app = QtGui.QApplication(["Winfred's PyQt OpenGL"]) widget = WfWidget() widget.show() app.exec_()
【问题讨论】:
-
不同的语言,但除此之外,这与几天前的几乎相同:stackoverflow.com/questions/24567993/…。
标签: python-2.7 opengl pyopengl