本文整理汇总了Python中pyglet.gl.gl_info.get_vendor函数的典型用法代码示例。如果您正苦于以下问题:Python get_vendor函数的具体用法?Python get_vendor怎么用?Python get_vendor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_vendor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_context
def create_context(self, share):
# Workaround for issue on certain Intel cards/drivers.
# TODO: Find out if there is a way to query for this problem
if wgl_info.have_extension('WGL_ARB_create_context') and gl_info.get_vendor() != 'Intel':
return Win32ARBContext(self, share)
else:
return Win32Context(self, share)
示例2: _setOpenGLInfo
def _setOpenGLInfo(self):
# OpenGL info:
self['openGLVendor'] = gl_info.get_vendor()
self['openGLRenderingEngine'] = gl_info.get_renderer()
self['openGLVersion'] = gl_info.get_version()
GLextensionsOfInterest=['GL_ARB_multitexture', 'GL_EXT_framebuffer_object','GL_ARB_fragment_program',
'GL_ARB_shader_objects','GL_ARB_vertex_shader', 'GL_ARB_texture_non_power_of_two','GL_ARB_texture_float']
for ext in GLextensionsOfInterest:
self['openGLext.'+ext] = bool(gl_info.have_extension(ext))
示例3: dump_gl
def dump_gl():
'''Dump GL info.'''
from pyglet.gl import gl_info
print 'gl_info.get_version():', gl_info.get_version()
print 'gl_info.get_vendor():', gl_info.get_vendor()
print 'gl_info.get_renderer():', gl_info.get_renderer()
print 'gl_info.get_extensions():'
extensions = list(gl_info.get_extensions())
extensions.sort()
for name in extensions:
print ' ', name
示例4: dump_gl
def dump_gl(context=None):
'''Dump GL info.'''
if context is not None:
info = context.get_info()
else:
from pyglet.gl import gl_info as info
print 'gl_info.get_version():', info.get_version()
print 'gl_info.get_vendor():', info.get_vendor()
print 'gl_info.get_renderer():', info.get_renderer()
print 'gl_info.get_extensions():'
extensions = list(info.get_extensions())
extensions.sort()
for name in extensions:
print ' ', name
示例5: dump_gl
def dump_gl(context=None):
"""Dump GL info."""
if context is not None:
info = context.get_info()
else:
from pyglet.gl import gl_info as info
print("gl_info.get_version():", info.get_version())
print("gl_info.get_vendor():", info.get_vendor())
print("gl_info.get_renderer():", info.get_renderer())
print("gl_info.get_extensions():")
extensions = list(info.get_extensions())
extensions.sort()
for name in extensions:
print(" ", name)
示例6: _setOpenGLInfo
def _setOpenGLInfo(self):
# OpenGL info:
self['openGLVendor'] = gl_info.get_vendor()
self['openGLRenderingEngine'] = gl_info.get_renderer()
self['openGLVersion'] = gl_info.get_version()
GLextensionsOfInterest = ['GL_ARB_multitexture', 'GL_EXT_framebuffer_object',
'GL_ARB_fragment_program', 'GL_ARB_shader_objects', 'GL_ARB_vertex_shader',
'GL_ARB_texture_non_power_of_two', 'GL_ARB_texture_float', 'GL_STEREO']
for ext in GLextensionsOfInterest:
self['openGLext.'+ext] = bool(gl_info.have_extension(ext))
maxVerts = GLint()
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, maxVerts)
self['openGLmaxVerticesInVertexArray'] = maxVerts.value
示例7: driversOkay
def driversOkay():
"""Returns True if drivers should be okay for PsychoPy"""
return gl_info.get_vendor().lower().find('microsoft') == -1
示例8: print
import pyglet
print("pyglet", pyglet.version)
# pyo is a new dependency, for sound:
try:
import pyo
print("pyo", '%i.%i.%i' % pyo.getVersion())
except Exception:
print('pyo [not installed]')
from psychopy import __version__
print("\nPsychoPy", __version__)
win = visual.Window([100, 100]) # some drivers want a window open first
print("have shaders:", win._haveShaders)
print("\nOpenGL info:")
# get info about the graphics card and drivers
print("vendor:", gl_info.get_vendor())
print("rendering engine:", gl_info.get_renderer())
print("OpenGL version:", gl_info.get_version())
print("(Selected) Extensions:")
extensionsOfInterest = ['GL_ARB_multitexture',
'GL_EXT_framebuffer_object', 'GL_ARB_fragment_program',
'GL_ARB_shader_objects', 'GL_ARB_vertex_shader',
'GL_ARB_texture_non_power_of_two', 'GL_ARB_texture_float', 'GL_STEREO']
for ext in extensionsOfInterest:
print("\t", bool(gl_info.have_extension(ext)), ext)
# also determine nVertices that can be used in vertex arrays
maxVerts = GLint()
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, maxVerts)
print('\tmax vertices in vertex array:', maxVerts.value)
示例9: main
def main():
macos = sys.platform == 'darwin'
parser = argparse.ArgumentParser(prog='punyverse', description='''
Python simulator of a puny universe.
''')
parser.set_defaults(sky=not macos)
parser.add_argument('-D', '--debug', help='Enable pyglet OpenGL debugging', action='store_true')
parser.add_argument('-d', '--high-depth', help='Use a larger depth buffer',
const=32, default=24, dest='depth', nargs='?', type=int)
parser.add_argument('-m', '--multisample', help='Use multisampled image, optional samples',
const=2, default=0, nargs='?', type=int)
parser.add_argument('-v', '--no-vsync', help='Disables vsync',
action='store_false', dest='vsync')
parser.add_argument('-n', '--normal', help='Enables the use of normal maps',
action='store_true')
parser.add_argument('-s', '--sky', help='Enables the sky', dest='sky',
action='store_true')
parser.add_argument('-S', '--no-sky', help='Disables the sky', dest='sky',
action='store_false')
args = parser.parse_args()
versioning = dict(major_version=3, minor_version=3)
pyglet.options['debug_gl'] = args.debug
if macos:
pyglet.options['shadow_window'] = False
versioning = dict(major_version=4, minor_version=1, forward_compatible=True)
template = pyglet.gl.Config(depth_size=args.depth, double_buffer=True,
sample_buffers=args.multisample > 1,
samples=args.multisample, **versioning)
platform = pyglet.window.get_platform()
display = platform.get_default_display()
screen = display.get_default_screen()
try:
config = screen.get_best_config(template)
except pyglet.window.NoSuchConfigException:
raise SystemExit('Graphics configuration not supported.')
create_args = dict(width=INITIAL_WIN_WIDTH, height=INITIAL_WIN_HEIGHT,
caption='Punyverse', resizable=True, vsync=args.vsync, visible=False)
from pyglet.gl import gl_info
from punyverse.loader import LoaderWindow, LoaderConsole
from punyverse.ui import Punyverse
if pyglet.compat_platform in ('win32', 'cygwin') and gl_info.get_vendor() == 'Intel':
# pyglet has some code that tries to create without ARB on Intel.
# Of course, all that achieves is the message that you can't create OpenGL 3 contexts.
# So we force create an ARB context.
from pyglet.gl.win32 import Win32ARBContext
context = Win32ARBContext(config, None)
# We use the console loader since using the GUI loader makes all sorts of wonderful things happen on Intel:
# Access violations, mouse events going nowhere, you name it.
loader = LoaderConsole()
punyverse = Punyverse(context=context, **create_args)
else:
context = config.create_context(None)
loader = LoaderWindow(width=INITIAL_WIN_WIDTH, height=INITIAL_WIN_HEIGHT,
caption='Punyverse is loading...')
punyverse = Punyverse(context=context, **create_args)
loader.context.set_current()
loader.set_main_context(punyverse.context)
world = loader.load(sky=args.sky)
punyverse.context.set_current()
punyverse.initialize(world)
loader.close()
punyverse.set_visible(True)
pyglet.app.run()
示例10: driversOkay
def driversOkay():
"""Returns True if drivers should be okay for PsychoPy"""
return not "microsoft" in gl_info.get_vendor().lower()
示例11:
display = platform.get_default_display()
print 'Display instance is %r' % display
print 'Screens:'
for screen in display.get_screens():
print ' %r' % screen
print 'Creating default context...'
w = pyglet.window.Window(1, 1, visible=True)
print 'GL attributes:'
attrs = w.config.get_gl_attributes()
attrs = ' '.join(['%s=%s'%(name, value) for name, value in attrs])
print '\n'.join(textwrap.wrap(attrs))
print 'GL version:', gl_info.get_version()
print 'GL vendor:', gl_info.get_vendor()
print 'GL renderer:', gl_info.get_renderer()
print 'GL extensions:'
exts = ' '.join(gl_info.get_extensions())
print ' ', '\n '.join(textwrap.wrap(exts))
print 'GLU version:', glu_info.get_version()
print 'GLU extensions:'
exts = ' '.join(glu_info.get_extensions())
print ' ', '\n '.join(textwrap.wrap(exts))
print
context = w.context
print 'Context is', context
示例12: getSysInfo
def getSysInfo(win):
from collections import OrderedDict
# based on sysInfo.py
from pyglet.gl import gl_info, GLint, glGetIntegerv, GL_MAX_ELEMENTS_VERTICES
import sys, platform
sys_info = OrderedDict()
sys_info['OS'] = OrderedDict()
sys_info['OS']['Name'] = platform.platform()
if sys.platform == 'darwin':
OSXver, _, architecture = platform.mac_ver()
sys_info['OS']['OSX Version'] = OSXver
sys_info['OS']['OSX Architecture'] = architecture
sys_info['Computer Hardware'] = OrderedDict()
try:
import psutil
def getMemoryInfo():
rdict = dict()
nt = psutil.virtual_memory()
for name in nt._fields:
value = getattr(nt, name)
if name != 'percent':
value = bytes2human(value)
rdict[name.capitalize()] = value # '%s%s%-10s : %7s\n'%(rstr, '\t' * indent, name.capitalize(), value)
return rdict
core_count = psutil.cpu_count(logical=False)
logical_psu_count = psutil.cpu_count()
memory_info = getMemoryInfo()
sys_info['Computer Hardware']['CPUs (cores / logical)'] = (core_count, logical_psu_count)
sys_info['Computer Hardware']['System Memory'] = memory_info
except Exception:
sys_info['Computer Hardware']['Failed'] = 'psutil 2.x + is required.'
sys_info['Python'] = OrderedDict()
sys_info['Python']['exe'] = sys.executable
sys_info['Python']['version'] = sys.version
sys_info['Packages'] = OrderedDict()
try:
import numpy
sys_info['Packages']['numpy'] = numpy.__version__
except ImportError:
sys_info['Packages']['numpy'] = "Not Installed"
try:
import pyglet
sys_info['Packages']['pyglet'] = pyglet.version
except ImportError:
sys_info['Packages']['pyglet'] = "Not Installed"
try:
import cv2
sys_info['Packages']['cv2'] = cv2.__version__
except ImportError:
sys_info['Packages']['cv2'] = "Not Installed"
try:
import psychopy
sys_info['Packages']['PsychoPy'] = psychopy.__version__
except ImportError:
sys_info['Packages']['PsychoPy'] = "Not Installed"
sys_info['Graphics'] = OrderedDict()
sys_info['Graphics']['shaders'] = win._haveShaders
sys_info['Graphics']['opengl'] = OrderedDict()
sys_info['Graphics']['opengl']['version'] = gl_info.get_version()
sys_info['Graphics']['opengl']['vendor'] = gl_info.get_vendor()
sys_info['Graphics']['opengl']['engine'] = gl_info.get_renderer()
maxVerts = GLint()
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, maxVerts)
sys_info['Graphics']['opengl']['Max vert in VA'] = maxVerts.value
sys_info['Graphics']['opengl']['extensions'] = OrderedDict()
extensionsOfInterest = ['GL_ARB_multitexture',
'GL_EXT_framebuffer_object', 'GL_ARB_fragment_program',
'GL_ARB_shader_objects', 'GL_ARB_vertex_shader',
'GL_ARB_texture_non_power_of_two', 'GL_ARB_texture_float', 'GL_STEREO']
for ext in extensionsOfInterest:
sys_info['Graphics']['opengl']['extensions'][ext] = bool(gl_info.have_extension(ext))
sys_info['Processes'] = OrderedDict()
if sys.platform == 'darwin':
sys_info['Processes']['Failed'] = 'Not Supported on OSX.'
elif SAVE_PER_PROCESS_DATA:
try:
import psutil
for proc in psutil.process_iter():
pkey = proc.pid
vattrs = ['name', 'exe', 'ppid', 'num_threads', 'memory_percent', 'cpu_percent', 'cpu_affinity', 'nice',
'num_ctx_switches']
procinfo = proc.as_dict(attrs=vattrs, ad_value=u"Access Denied")
if procinfo['exe'] is not u"Access Denied" and (SAVE_PER_PROCESS_DATA is True or SAVE_PER_PROCESS_DATA == procinfo['name']):
sys_info['Processes'][pkey] = procinfo
except ImportError:
sys_info['Processes']['Failed'] = 'psutil 2.x + is required.'
else:
sys_info['Processes']['Disabled'] = 'Per Process details disabled by user.'
return sys_info
示例13: DriverError
return self.message
class DriverError(Exception):
pass
class GLSLError(Exception):
pass
def require_extension(ext):
"""Ensure that the given graphics extension is supported.
"""
if not gl.gl_info.have_extension('GL_' + ext):
raise HardwareSupportError("the %s extension" % ext)
hardware_info = {'vendor': gli.get_vendor(),
'renderer': gli.get_renderer(),
'version': gli.get_version()}
# Check hardware support
_opengl_version = hardware_info['version'].split(' ')[0]
if _opengl_version < "2.0":
raise DriverError("This package requires OpenGL v2.0 or higher. "
"Your version is %s." % _opengl_version)
# This extension is required to return floats outside [0, 1]
# in gl_FragColor
require_extension('ARB_color_buffer_float')
require_extension('ARB_texture_float')
示例14: init_gui
def init_gui():
global main_window, sched_queue, current_time, fps_limit
config = pyglet.gl.Config(
double_buffer=True,
buffer_size=32,
aux_buffers=0,
sample_buffers=0,
samples=0,
red_size=8,
green_size=8,
blue_size=8,
alpha_size=8,
depth_size=0,
stencil_size=0,
accum_red_size=0,
accum_green_size=0,
accum_blue_size=0,
accum_alpha_size=0,
)
from options import options
z = options.zoom
main_window = pyglet.window.Window(
width=int(WINDOW_WIDTH * z), height=int(WINDOW_HEIGHT * z), caption=u'东方符斗祭',
config=config, visible=False
)
sched_queue = []
from pyglet.gl import gl_info
vendor = gl_info.get_vendor().lower()
if 'amd' in vendor or 'ati' in vendor:
pyglet.options['graphics_vbo'] = False # AMD: Do you have QA team for your OpenGL driver ????
from pyglet.graphics import vertexbuffer
assert not vertexbuffer._enable_vbo
# custom font renderer
from .font import AncientPixFont
pyglet.font._font_class = AncientPixFont
# main window setup {{
glClearColor(1, 1, 1, 1)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
# glEnable(GL_SCISSOR_TEST)
glPolygonMode(GL_FRONT, GL_FILL)
glPolygonMode(GL_BACK, GL_LINE)
def_overlay = Overlay()
def_overlay.name = 'Overlay'
def_overlay.switch()
# }} main window setup
fps = pyglet.clock.ClockDisplay()
fps_limit = 60
delay = 1. / fps_limit
current_time = time()
@main_window.event
def on_draw():
global current_time
current_time = time()
Overlay.cur_overlay.draw()
fps.draw()
@main_window.event
def on_close():
# HACK: suppress exceptions,
# dont want to explain....
pyglet.clock.tick = lambda a: 0.0
pyglet.app.exit()
@hook(main_window)
def on_key_press(ori, symbol, modifiers):
if symbol == pyglet.window.key.ESCAPE:
return pyglet.event.EVENT_HANDLED
return ori(symbol, modifiers)
def _dispatch_msg(dt):
global sched_queue
import gevent
# give logics a chance to run
gevent.sleep(0.001)
if not sched_queue: return
for func in sched_queue:
func()
sched_queue = []
pyglet.clock.schedule_interval(_dispatch_msg, delay)
示例15: getSysInfo
def getSysInfo(win):
try:
from collections import OrderedDict
except:
from psychopy.iohub import OrderedDict
# based on sysInfo.py
from pyglet.gl import gl_info, GLint, glGetIntegerv, GL_MAX_ELEMENTS_VERTICES
import sys, platform
sys_info = OrderedDict()
sys_info["OS"] = OrderedDict()
sys_info["OS"]["Name"] = platform.platform()
if sys.platform == "darwin":
OSXver, _, architecture = platform.mac_ver()
sys_info["OS"]["OSX Version"] = OSXver
sys_info["OS"]["OSX Architecture"] = architecture
sys_info["Computer Hardware"] = OrderedDict()
try:
import psutil
def getMemoryInfo():
rdict = dict()
nt = psutil.virtual_memory()
for name in nt._fields:
value = getattr(nt, name)
if name != "percent":
value = bytes2human(value)
rdict[name.capitalize()] = value #'%s%s%-10s : %7s\n'%(rstr,'\t'*indent,name.capitalize(), value)
return rdict
core_count = psutil.cpu_count(logical=False)
logical_psu_count = psutil.cpu_count()
memory_info = getMemoryInfo()
sys_info["Computer Hardware"]["CPUs (cores / logical)"] = (core_count, logical_psu_count)
sys_info["Computer Hardware"]["System Memory"] = memory_info
except:
sys_info["Computer Hardware"]["Failed"] = "psutil 2.x + is required."
sys_info["Python"] = OrderedDict()
sys_info["Python"]["exe"] = sys.executable
sys_info["Python"]["version"] = sys.version
sys_info["Packages"] = OrderedDict()
try:
import numpy
sys_info["Packages"]["numpy"] = numpy.__version__
except:
sys_info["Packages"]["numpy"] = "Not Installed"
try:
import pyglet
sys_info["Packages"]["pyglet"] = pyglet.version
except:
sys_info["Packages"]["pyglet"] = "Not Installed"
try:
import cv2
sys_info["Packages"]["cv2"] = cv2.__version__
except:
sys_info["Packages"]["cv2"] = "Not Installed"
try:
import psychopy
sys_info["Packages"]["PsychoPy"] = psychopy.__version__
except:
sys_info["Packages"]["PsychoPy"] = "Not Installed"
sys_info["Graphics"] = OrderedDict()
sys_info["Graphics"]["shaders"] = win._haveShaders
sys_info["Graphics"]["opengl"] = OrderedDict()
sys_info["Graphics"]["opengl"]["version"] = gl_info.get_version()
sys_info["Graphics"]["opengl"]["vendor"] = gl_info.get_vendor()
sys_info["Graphics"]["opengl"]["engine"] = gl_info.get_renderer()
maxVerts = GLint()
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, maxVerts)
sys_info["Graphics"]["opengl"]["Max vert in VA"] = maxVerts.value
sys_info["Graphics"]["opengl"]["extensions"] = OrderedDict()
extensionsOfInterest = [
"GL_ARB_multitexture",
"GL_EXT_framebuffer_object",
"GL_ARB_fragment_program",
"GL_ARB_shader_objects",
"GL_ARB_vertex_shader",
"GL_ARB_texture_non_power_of_two",
"GL_ARB_texture_float",
"GL_STEREO",
]
for ext in extensionsOfInterest:
sys_info["Graphics"]["opengl"]["extensions"][ext] = bool(gl_info.have_extension(ext))
sys_info["Processes"] = OrderedDict()
if sys.platform == "darwin":
sys_info["Processes"]["Failed"] = "Not Supported on OSX."
elif SAVE_PER_PROCESS_DATA:
try:
import psutil
#.........这里部分代码省略.........