标签: glutcreatewindow

Python glutCreateWindow错误'错误类型'

我正在尝试在python中创建一个过剩的窗口,并具有以下代码:

glutInit()
    glutInitWindowSize(windowWidth, windowHeight)
    glutInitWindowPosition(int(centreX - windowWidth/2), int(centreY - windowHeight/2))
    glutCreateWindow("MyWindow")
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
    glutDisplayFunc(displayFun)
    glutIdleFunc(animateFun)
    glutKeyboardFunc(keyboardFun)
    glutPassiveMotionFunc(mouseFun)

    glutReshapeFunc(reshapeFun)
    initFun()
    #loadTextures()
    glutMainLoop()
Run Code Online (Sandbox Code Playgroud)

我在'glutCreateWindow'一行中收到错误说:

Traceback (most recent call last):
  File "F:\MyProject\main.py", line 301, in <module>
    glutCreateWindow("MyWindow")
  File "C:\Python34\lib\site-packages\OpenGL\GLUT\special.py", line 73, in glutCreateWindow
    return __glutCreateWindowWithExit(title, _exitfunc)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
Run Code Online (Sandbox Code Playgroud)

有关此函数的文档指定

int glutCreateWindow(char *name);
Run Code Online (Sandbox Code Playgroud)

python glut glutcreatewindow

6
推荐指数
1
解决办法
7343
查看次数

glutCloseFunc没有终止应用程序

我已经创建了一个窗口,glutCreateWindow并开始使用循环glutMainLoop.我想结束那个循环并关闭窗口,所以我使用glutLeaveMainLoopglutCloseFunc销毁它.我的应用程序自动终止.

我希望应用程序在窗口被销毁后继续存在.可能吗?

根据这个链接,我可以做到,但我不知道如何.我正在使用freeglut.

c++ opengl glut freeglut glutcreatewindow

3
推荐指数
1
解决办法
1114
查看次数

标签 统计

glut ×2

glutcreatewindow ×2

c++ ×1

freeglut ×1

opengl ×1

python ×1