Example #1
0
File: qt.py Project: vintch/pegl
    def __init__(self):
        super().__init__()

        self.render = QtGui.QWidget()
        self.setCentralWidget(self.render)

        self.display = display.Display()
        self.config = config.get_configs(self.display)[0]
        self.surface = surface.WindowSurface(self.display, self.config, {},
                                             self.render.winId())

        self.resize(640, 480)
        self.setWindowTitle('Pegl test: Qt')

        self.show()
Example #2
0
File: qtpegl.py Project: perey/pegl
    def __init__(self):
        super().__init__()

        self.render = QtGui.QWidget()
        self.setCentralWidget(self.render)

        self.display = display.Display()
        self.config = config.get_configs(self.display)[0]
        self.surface = surface.WindowSurface(self.display, self.config, {},
                                             self.render.winId())

        self.resize(640, 480)
        self.setWindowTitle('Pegl test')

        self.show()
Example #3
0
    def __init__(self, dpy):
        self.Xdisplay = dpy
        self.screen = self.Xdisplay.screen()

        self.window = self.screen.root.create_window(5, 5, 640, 480, 1,
                                                     self.screen.root_depth)
        self.DELETE_WINDOW = self.Xdisplay.intern_atom('WM_DELETE_WINDOW')
        self.PROTOCOLS = self.Xdisplay.intern_atom('WM_PROTOCOLS')

        self.window.set_wm_name('Pegl test: X11')
        self.window.set_wm_protocols((self.DELETE_WINDOW, ))

        self.EGLdisplay = display.Display()
        self.config = config.get_configs(self.EGLdisplay)[0]
        self.surface = surface.WindowSurface(self.EGLdisplay, self.config, {},
                                             self.window.id)
        self.window.map()
Example #4
0
if first_supported is not None:
    print("Trying to enable extension '{}'...".format(first_supported),
          end=' ')
    try:
        ext = d.load_extension(first_supported)
    except ImportError:
        print('Failed!')
    else:
        print('Success!')
else:
    print('No extensions supported by Pegl and by the implementation.',
          'Skipping extension-loading test.')
print()

# 2. Getting available configurations.
c = get_configs(d)
print('There are', len(c), 'configurations available.')

# 2a. Paring down the configurations by selecting desired attributes.
reqs = {'RENDERABLE_TYPE': ClientAPIs(OPENGL=1)}
c_gl = get_configs(d, reqs)
print(
    len(c_gl), 'configurations support OpenGL.' +
    (' (I wonder what the other ' + str(len(c) - len(c_gl)) +
     ' do?)' if len(c) - len(c_gl) else ''))

reqs['RENDERABLE_TYPE'].OPENGL = 0
reqs['RENDERABLE_TYPE'].OPENGL_ES = 1
c_es = get_configs(d, reqs)
print(len(c_es), 'configurations support OpenGL ES 1.x.')
Example #5
0
    print('The following client extensions are supported:')
    print('  *', '\n *'.join(xt.client_extensions))
    print()

# 1. Initialising the EGL display.
d = Display(delay_init=True)
print('Initialised EGL version {0[0]}.{0[1]} ({1} '
      '{2!s}).'.format(d.initialize(), d.vendor, d.version))
print('This implementation supports these APIs:')
print('  *', '\n  * '.join(d.client_apis))
print('...and these extensions:')
print('  *', '\n  * '.join(d.extensions))
print()

# 2. Getting available configurations.
c = get_configs(d)
print('There are', len(c), 'configurations available.')

# 2a. Paring down the configurations by selecting desired attributes.
reqs = {'RENDERABLE_TYPE': ClientAPIs(OPENGL=1)}
c_gl = get_configs(d, reqs)
print(len(c_gl), 'configurations support OpenGL.' +
      (' (I wonder what the other ' + str(len(c) - len(c_gl)) + ' do?)'
       if len(c) - len(c_gl) else ''))

reqs['RENDERABLE_TYPE'].OPENGL = 0
reqs['RENDERABLE_TYPE'].OPENGL_ES = 1
c_es = get_configs(d, reqs)
print(len(c_es), 'configurations support OpenGL ES 1.x.')

reqs['RENDERABLE_TYPE'].OPENGL_ES = 0