我有兴趣设置一个环境来使用 pyOpenGL 编写粒子模拟器。我已经安装了 pyOpenGL。这是测试代码,只是为了确保 opengl 正常工作。
from OpenGL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
window = 0
width, height = 500,400
def draw():
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT)
glLoadIdentity()
glutDwapBuffers()
#initialization
glutInit()
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width,height)
glutInitWindowPosition(0,0)
window = glutCreateWindow(b"noobtute")
glutDisplayFunc(draw)
glutIdleFunc(draw)
glutMainLoop()
Run Code Online (Sandbox Code Playgroud)
但是,当我从命令运行脚本时,出现以下错误:
NameError: name 'glClear' is not defined
GLUT Display callback <function draw at 0x0000000002F8CB70> with (),{} failed:
returning None name 'glClear' is not defined
Run Code Online (Sandbox Code Playgroud)
我尝试重新安装 pyOpengl 但没有成功。
我在 Windows 8.1 上运行 Python …
So I am looking to simply format the offset string (at least that is what i think it is called, see image) that matplotlib places along with an axis that has been set to show tick labels in scientific notation, but where the range is less than one order of magnitude (power of 10).
here is what I am talking about:
Essentially, how do I make it bigger/coloured?
python ×2
format ×1
matplotlib ×1
nameerror ×1
plot ×1
pyopengl ×1
python-3.x ×1
windows-8.1 ×1