64位PyOpenGL不能使用单个缓冲区?

2024-04-26 04:36:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我最近升级到64位机器,并安装了PyOpenGL 64位。我使用的是PyOpenGL的3.1.0a1版本和python2.7.6。我的旧代码已停止在单缓冲区模式下工作。我也尝试过pyopengl3.0.2,但没有什么不同。所以这里的代码是:

from OpenGL.GL import *
from OpenGL.GLUT import *

def display():
    glClearColor(1.0, 0.0, 0.0, 1.0)
    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()
    glFlush()

glutInit()
glutInitDisplayMode (GLUT_SINGLE)
glutInitWindowSize (500, 500)
glutInitWindowPosition (100, 100)
glutCreateWindow ("OpenGL Window")
glutDisplayFunc(display)
glutMainLoop()

生成窗口,但从不渲染其中的任何内容。你知道吗

另一方面,此代码运行良好,出现了一个漂亮的红色框:

from OpenGL.GL import *
from OpenGL.GLUT import *

def display():
    glClearColor(1.0, 0.0, 0.0, 1.0)
    glClear(GL_COLOR_BUFFER_BIT)
    glLoadIdentity()
    glutSwapBuffers()

glutInit()
glutInitDisplayMode (GLUT_DOUBLE)
glutInitWindowSize (500, 500)
glutInitWindowPosition (100, 100)
glutCreateWindow ("OpenGL Window")
glutDisplayFunc(display)
glutMainLoop()

有人知道为什么吗?你知道吗


Tags: 代码fromimportdefbufferdisplaybitcolor