本文整理汇总了Python中pyglet.gl.gl_info.get_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_version函数的具体用法?Python get_version怎么用?Python get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_version函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _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))
示例2: 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
示例3: 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
示例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: _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
示例6: _getGfxCardString
def _getGfxCardString(self):
from pyglet.gl import gl_info
thisStr = "%s: %s" %(gl_info.get_renderer(), gl_info.get_version())
return thisStr
示例7: 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)
示例8:
print 'Platform instance is %r' % platform
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
示例9: 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
示例10: DriverError
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')
gl.glClampColorARB(gl.GL_CLAMP_VERTEX_COLOR_ARB, False)
gl.glClampColorARB(gl.GL_CLAMP_FRAGMENT_COLOR_ARB, False)
示例11: 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
#.........这里部分代码省略.........
示例12: run
def run(self):
import pyglet
pyglet.options['debug_gl'] = False
from dypy.tools.PortraitTool import PortraitTool
from dypy.tools.OrbitTool import OrbitTool
from dypy.tools.CobwebTool import CobwebTool
# unfortunately, pyglet imports must occur in the same scope as the pyglet window
from pyglet.gl import glBlendFunc, glEnable, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, \
GL_BLEND, glClear, GL_COLOR_BUFFER_BIT, glMatrixMode, GL_PROJECTION, GL_MODELVIEW, \
glLoadIdentity, glTranslatef, glRotatef, gl_info, glViewport, glOrtho, \
glHint, GL_LINE_SMOOTH, GL_LINE_SMOOTH_HINT, GL_NICEST, glDisable
import pyglet.clock
import pyglet.window
import select
self.window = pyglet.window.Window(width=self.width, height=self.height, visible=False)
self.window.set_location(450, 0)
self.window.on_resize = self.on_resize
self.window.on_close = self.on_close
self.window.on_key_press = self.on_key_press
self.window.on_mouse_drag = self.on_mouse_drag
self.window.on_mouse_scroll = self.on_mouse_scroll
self.window.on_mouse_press = self.on_mouse_press
self.window.on_mouse_release = self.on_mouse_release
# create and wait for object server
self.object_server = PyroServer()
self.object_server.start()
self.object_server.waitUntilStarted()
# create p5 vr glove server
self.glove_server = P5Device(self)
self.glove_server.start()
# create nintento wiimote server
self.wiimote_server = WiimoteDevice(self)
self.wiimote_server.start()
# create 3Dconnexion space navigator server
self.sn_server = SpaceNavigatorDevice(self)
self.sn_server.start()
# visualization parameters
self.rotation_velocity = 0.8
self.iteration = 0
self.reset_rotation()
self.set_axes_center()
self.set_bounds((-1, 1), (-1, 1), (-1, 1), False)
# don't hog more cpu than is useful
pyglet.clock.set_fps_limit(self.fps)
# create tools and connect them to server
self.object_server.daemon.connect(self, 'ToolServer')
t = PortraitTool(server=self)
self.object_server.daemon.connect(t, 'PortraitTool')
t = CobwebTool(server=self)
self.object_server.daemon.connect(t, 'CobwebTool')
t = OrbitTool(server=self)
self.object_server.daemon.connect(t, 'OrbitTool')
self.update_tool(t)
# set alpha blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
# enable line anti-aliasing
glEnable(GL_LINE_SMOOTH)
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST)
# gl diagnostics
dypy.debug("ToolServer", "GL version is %s." % gl_info.get_version())
dypy.debug("ToolServer", "GL renderer is %s." % gl_info.get_renderer())
dypy.debug("ToolServer", "Pyglet version is %s." % pyglet.version)
# event flags
self.ready = True
self.tool_updated = False
self.window_resized = False
self.visible = False
self.visibility_changed = False
self.show_axes = False
while not self.window.has_exit:
pyglet.clock.tick()
gl_lock.acquire()
try:
self.window.dispatch_events()
if self.visibility_changed:
self.visibility_changed = False
self.window.set_visible(self.visible)
if self.tool_updated:
self.tool_updated = False
#.........这里部分代码省略.........