本文整理汇总了Python中pyglet.gl.gl_info.have_extension函数的典型用法代码示例。如果您正苦于以下问题:Python have_extension函数的具体用法?Python have_extension怎么用?Python have_extension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了have_extension函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _get_arb_pixel_format_matching_configs
def _get_arb_pixel_format_matching_configs(self, canvas):
'''Get configs using the WGL_ARB_pixel_format extension.
This method assumes a (dummy) GL context is already created.'''
# Check for required extensions
if self.sample_buffers or self.samples:
if not gl_info.have_extension('GL_ARB_multisample'):
return []
# Construct array of attributes
attrs = []
for name, value in self.get_gl_attributes():
attr = Win32CanvasConfigARB.attribute_ids.get(name, None)
if attr and value is not None:
attrs.extend([attr, int(value)])
attrs.append(0)
attrs = (c_int * len(attrs))(*attrs)
pformats = (c_int * 16)()
nformats = c_uint(16)
wglext_arb.wglChoosePixelFormatARB(canvas.hdc, attrs, None,
nformats, pformats, nformats)
formats = [Win32CanvasConfigARB(canvas, pf, self) \
for pf in pformats[:nformats.value]]
return formats
开发者ID:JacquesLucke,项目名称:still-lambda,代码行数:26,代码来源:win32.py
示例2: load_image
def load_image(self):
if not gl_info.have_extension('GL_ARB_imaging'):
print 'GL_ARB_imaging is not present, skipping test.'
self.has_exit = True
else:
# Load image as usual then rearrange components
super(TEST_MATRIX_RGBA, self).load_image()
pixels = self.image.get_data('GBAR', self.image.width * 4)
开发者ID:shrimpboyho,项目名称:herblore,代码行数:8,代码来源:MATRIX_RGBA.py
示例3: load_image
def load_image(self):
if not gl_info.have_extension('GL_ARB_imaging'):
print('GL_ARB_imaging is not present, skipping test.')
self.has_exit = True
else:
# Load image as usual then rearrange components
super(TEST_MATRIX_RGB, self).load_image()
self.image.format = 'GRB'
pixels = self.image.data # forces conversion
开发者ID:DiscoBizzle,项目名称:Ghost-Simulator,代码行数:9,代码来源:MATRIX_RGB.py
示例4: _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))
开发者ID:MattIBall,项目名称:psychopy,代码行数:10,代码来源:info.py
示例5: _get_gl_format_and_type
def _get_gl_format_and_type(self, format):
if format == 'I':
return GL_LUMINANCE, GL_UNSIGNED_BYTE
elif format == 'L':
return GL_LUMINANCE, GL_UNSIGNED_BYTE
elif format == 'LA':
return GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE
elif format == 'R':
return GL_RED, GL_UNSIGNED_BYTE
elif format == 'G':
return GL_GREEN, GL_UNSIGNED_BYTE
elif format == 'B':
return GL_BLUE, GL_UNSIGNED_BYTE
elif format == 'A':
return GL_ALPHA, GL_UNSIGNED_BYTE
elif format == 'RGB':
return GL_RGB, GL_UNSIGNED_BYTE
elif format == 'RGBA':
return GL_RGBA, GL_UNSIGNED_BYTE
elif (format == 'ARGB' and
gl_info.have_extension('GL_EXT_bgra') and
gl_info.have_extension('GL_APPLE_packed_pixels')):
return GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
elif (format == 'ABGR' and
gl_info.have_extension('GL_EXT_abgr')):
return GL_ABGR_EXT, GL_UNSIGNED_BYTE
elif (format == 'BGR' and
gl_info.have_extension('GL_EXT_bgra')):
return GL_BGR, GL_UNSIGNED_BYTE
elif (format == 'BGRA' and
gl_info.have_extension('GL_EXT_bgra')):
return GL_BGRA, GL_UNSIGNED_BYTE
elif (format == 'ABGR1555'):
return GL_BGRA,GL_UNSIGNED_SHORT_1_5_5_5_REV
return None, None
开发者ID:HuFlungDu,项目名称:GSEF,代码行数:36,代码来源:GtkGlDrawingArea.py
示例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
开发者ID:alexholcombe,项目名称:psychopy,代码行数:15,代码来源:info.py
示例7: _init_texture
def _init_texture(self, player):
if not self.video_format:
return
width = self.video_format.width
height = self.video_format.height
if gl_info.have_extension('GL_ARB_texture_rectangle'):
texture = image.Texture.create_for_size(
gl.GL_TEXTURE_RECTANGLE_ARB, width, height,
internalformat=gl.GL_RGB)
else:
texture = image.Texture.create_for_size(
gl.GL_TEXTURE_2D, width, height, internalformat=gl.GL_RGB)
if texture.width != width or texture.height != height:
texture = texture.get_region(0, 0, width, height)
player._texture = texture
# Flip texture coords (good enough for simple apps).
bl, br, tr, tl = player._texture.tex_coords
player._texture.tex_coords = tl, tr, br, bl
开发者ID:certik,项目名称:sympy-oldcore,代码行数:20,代码来源:avbin.py
示例8: __init__
def __init__(self, wrap = GL_REPEAT, filter = GL_LINEAR, min_filter = None):
if self.max_anisotropy == 0.0 and \
gl_info.have_extension('GL_EXT_texture_filter_anisotropic'):
v = c_float()
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, byref(v))
self.max_anisotropy = v.value
if min_filter is None: min_filter = filter
self.min_filter = min_filter
self.mag_filter = filter
self.min_lod = -1000
self.max_lod = 1000
self.min_mipmap = 0
self.max_mipmap = 1000
self.wrap_s = wrap
self.wrap_t = wrap
self.wrap_r = wrap
self.priority = 0
self.anisotropy = 1.0
self.border_colour = c_float4(0.0, 0.0, 0.0, 0.0)
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:20,代码来源:blur.py
示例9: renderToTexture
def renderToTexture(w, h, function):
import ctypes
from pyglet import gl
from pyglet import image
from pyglet.gl import gl_info
global has_fbo
if has_fbo is None:
has_fbo = gl_info.have_extension("GL_EXT_framebuffer_object")
# enforce dimensions are ints
w, h = int(w), int(h)
# set up viewport
gl.glPushAttrib(gl.GL_VIEWPORT_BIT | gl.GL_TRANSFORM_BIT)
gl.glViewport(0, 0, w, h)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glPushMatrix()
gl.glLoadIdentity()
gl.glOrtho(0, w, 0, h, -1, 1)
gl.glMatrixMode(gl.GL_MODELVIEW)
if has_fbo:
# render directly to texture
# create our frame buffer
fbo = gl.GLuint()
gl.glGenFramebuffersEXT(1, ctypes.byref(fbo))
gl.glBindFramebufferEXT(gl.GL_FRAMEBUFFER_EXT, fbo)
# allocate a texture and add to the frame buffer
tex = image.Texture.create_for_size(gl.GL_TEXTURE_2D, w, h, gl.GL_RGBA)
gl.glBindTexture(gl.GL_TEXTURE_2D, tex.id)
gl.glFramebufferTexture2DEXT(gl.GL_FRAMEBUFFER_EXT, gl.GL_COLOR_ATTACHMENT0_EXT, gl.GL_TEXTURE_2D, tex.id, 0)
status = gl.glCheckFramebufferStatusEXT(gl.GL_FRAMEBUFFER_EXT)
assert status == gl.GL_FRAMEBUFFER_COMPLETE_EXT
# now render
gl.glBindFramebufferEXT(gl.GL_FRAMEBUFFER_EXT, fbo)
function()
gl.glBindFramebufferEXT(gl.GL_FRAMEBUFFER_EXT, 0)
# clean up
gl.glDeleteFramebuffersEXT(1, ctypes.byref(fbo))
else:
# render and copy to texture
# render
function()
# grab the buffer and copy contents to the texture
buffer = image.get_buffer_manager().get_color_buffer()
tex = image.Texture.create_for_size(gl.GL_TEXTURE_2D, w, h, gl.GL_RGBA)
tex.blit_into(buffer.get_region(0, 0, w, h), 0, 0, 0)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glPopMatrix()
gl.glPopAttrib()
# return the region (the whole texture will most likely be larger)
return tex.get_region(0, 0, w, h)
开发者ID:rougier,项目名称:pyglet,代码行数:63,代码来源:util.py
示例10: _get_infolog
pass
def _get_infolog(oid):
buffer = create_string_buffer(3000)
i = GLsizei(0)
glGetInfoLogARB(
oid, 3000, byref(i), cast(
byref(buffer),
POINTER(c_char)
)
)
return buffer.value
HAVE_SHADER = gl_info.have_extension('GL_ARB_shader_objects')
class _Shader(object):
def __new__(cls, *a):
if HAVE_SHADER:
return object.__new__(cls, *a)
else:
return None
def __init__(self, src):
sid = False
try:
sid = glCreateShaderObjectARB(self.shader_type)
except GLException:
pass
开发者ID:17night,项目名称:thbattle,代码行数:31,代码来源:shader.py
示例11: 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)
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:30,代码来源:sysInfo.py
示例12: 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
#.........这里部分代码省略.........
开发者ID:natsn,项目名称:psychopy,代码行数:101,代码来源:MovieStim2TimingTest.py
示例13: draw_task
# http://www.opengl.org/registry/specs/ARB/point_parameters.txt
from pyglet.gl import gl_info
assert gl_info.have_extension("GL_ARB_point_parameters"), "ARB_point_parameters not available"
from pyglet.gl import *
import random
import math
g_slowdown = 2.0
# Query for the max point size supported by the hardware
maxSize = c_float(0.0)
maxSize = GLfloat(0.0)
glGetFloatv(GL_POINT_SIZE_MAX_ARB, maxSize)
print "GL_POINT_SIZE_MAX_ARB", maxSize.value # 256.0
def draw_task(texture_id, size, pos):
particles = [{
'life': 1.0,
'fade': random.uniform(0.1, 0.004),
'r': 1.0, 'g': 1.0, 'b': 1.0,
'x': 0.0, 'y': 0.0, 'z': 0.0,
'xi': float(random.randint(-250, 250)),
'yi': 0.0,#float(random.randint(-250, 250)),
'zi': float(random.randint(-250, 250)),
'xg': 0.0, 'yg': -0.8, 'zg': 0.0,
} for i in xrange(50)]
mat = (GLfloat*16)()
viewport = (GLint*4)()
开发者ID:kovrov,项目名称:scrap,代码行数:31,代码来源:particles_points.py
示例14: supported
def supported():
" Requires OpenGL >= 3.2 && GLSL >= 1.50 "
return check_requirements(target_gl=(3,2), target_glsl=(1,50)) and gl_info.have_extension('GL_ARB_gpu_shader_fp64')
开发者ID:gabdube,项目名称:pyshaders,代码行数:3,代码来源:double_uniforms.py
示例15: draw_task
from pyglet.gl import gl_info
assert gl_info.have_extension("GL_ARB_point_sprite"), "ARB_point_sprite not available"
from pyglet.gl import *
import random
# see:
# http://www.opengl.org/registry/specs/ARB/point_sprite.txt
# http://www.opengl.org/registry/specs/ARB/point_parameters.txt
g_slowdown = 2.0
# Query for the max point size supported by the hardware
g_maxSize = c_float(0.0)
glGetFloatv(GL_POINT_SIZE_MAX_ARB, pointer(g_maxSize))
# Clamp size to 100.0f or the sprites could get a little too big on some of the
# newer graphic cards. My ATI card at home supports a max point size of 1024.0!
if (g_maxSize.value > 100.0): g_maxSize.value = 100.0
def draw_task(texture_id):
particles = [{
'life': 1.0,
'fade': random.uniform(0.1, 0.004),
#'r': 1.0, 'g': 1.0, 'b': 1.0,
'r': 0.32, 'g': 0.32, 'b': 0.32,
'x': 0.0, 'y': 0.0, 'z': 0.0,
'xi': float(random.randint(-250, 250)),
'yi': float(random.randint(-250, 250)),
'zi': float(random.randint(-250, 250)),
'xg': 0.0, 'yg': -0.8, 'zg': 0.0,
} for i in xrange(1000)]
开发者ID:kovrov,项目名称:scrap,代码行数:31,代码来源:particles_point_sprites.py
示例16: 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
开发者ID:ChenTzuYin,项目名称:psychopy,代码行数:100,代码来源:MovieStim2TimingTest.py
注:本文中的pyglet.gl.gl_info.have_extension函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论