Пример #1
0
    def __init__(self, parent=None):
        self.first = True
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        if QT_VERSION == 4:
            QGLWidget.__init__(self, QGLContext(f, None), parent)
        else:
            # Qt 5
            QGLWidget.__init__(self, QGLContext(f), parent)

        print(('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion())))

        print("This script creates a file called 'opengl-test.txt', containing information about the opengl support of your computer. Useful when debugging problems with the opengl version of BlueSky.")
 def paintEvent(self, ev):
     if self.usingGL:
         current = QGLContext.currentContext()
         self.glViewport.makeCurrent()
         super(GLGraphicsView, self).paintEvent(ev)
         self.glViewport.doneCurrent()  # dirty workaround...
         if current:
             current.makeCurrent()
     else:
         super(GLGraphicsView, self).paintEvent(ev)
Пример #3
0
def getProcAddress(proc: bytes) -> int:
    if sys.platform == 'win32':
        _ctx = QGLContext.currentContext()
        if _ctx is None:
            return 0
        _gpa = (_ctx.getProcAddress, proc.decode())
    elif sys.platform == 'darwin':
        _gpa = (glutGetProcAddress, proc)
    else:
        # noinspection PyUnresolvedReferences
        _getProcAddress = PLATFORM.getExtensionProcedure
        _getProcAddress.argtypes = [c_char_p]
        _getProcAddress.restype = c_void_p
        _gpa = (_getProcAddress, proc)
    return _gpa[0](_gpa[1]).__int__()
Пример #4
0
def get_proc_address(name):
    glctx = QGLContext.currentContext()
    if glctx is None:
        return 0
    name = name.decode()
    res = glctx.getProcAddress(name)
    if name == 'glMPGetNativeDisplay' and res is None:
        return MPGetNativeDisplay
    try:
        if sys.platform == 'win32' and res is None:
            from PyQt5.QtWidgets import QOpenGLContext
            from win32api import GetProcAddress
            handle = QOpenGLContext.openGLModuleHandle()
            if handle is not None:
                res = GetProcAddress(handle, name)
    except ImportError:
        return 0
    return res.__int__()
Пример #5
0
def get_proc_addr(_, name):
    glctx = QGLContext.currentContext()
    if glctx is None:
        return 0
    addr = int(glctx.getProcAddress(name.decode('utf-8')))
    return addr
Пример #6
0
def get_proc_addr(_: Any, name: bytes) -> int:
    glctx = QGLContext.currentContext()
    if glctx is None:
        return None
    addr = int(glctx.getProcAddress(name.decode("utf-8")))
    return addr
Пример #7
0
def get_proc_address(proc):
    glctx = QGLContext.currentContext()
    if glctx is None:
        return None
    addr = glctx.getProcAddress(str(proc, 'utf-8'))
    return addr.__int__()