本文整理汇总了Python中pyglet.gl.glEnable函数的典型用法代码示例。如果您正苦于以下问题:Python glEnable函数的具体用法?Python glEnable怎么用?Python glEnable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了glEnable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_state
def set_state(self):
gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_TRANSFORM_BIT | gl.GL_CURRENT_BIT)
gl.glEnable(gl.GL_BLEND)
gl.glBlendFuncSeparate(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA)
# To Allow Normal Rendering when Buffering with FrameBufferObject
# Without this option : problem with alpha blending when rendering buffered GUI textures
#Also in context.glContext
# Disable clipping planes to check culling.
gl.glEnable(gl.GL_CLIP_PLANE0)
gl.glEnable(gl.GL_CLIP_PLANE1)
gl.glEnable(gl.GL_CLIP_PLANE2)
gl.glEnable(gl.GL_CLIP_PLANE3)
# Left
gl.glClipPlane(gl.GL_CLIP_PLANE0, (gl.GLdouble * 4)(
1, 0, 0, -(self._clip_x - 1)))
# Top
gl.glClipPlane(gl.GL_CLIP_PLANE1, (gl.GLdouble * 4)(
0, -1, 0, self._clip_y))
# Right
gl.glClipPlane(gl.GL_CLIP_PLANE2, (gl.GLdouble * 4)(
-1, 0, 0, self._clip_x + self._clip_width + 1))
# Bottom
gl.glClipPlane(gl.GL_CLIP_PLANE3, (gl.GLdouble * 4)(
0, 1, 0, -(self._clip_y - self._clip_height)))
gl.glTranslatef(self.translate_x, self.translate_y, 0)
开发者ID:samcorcoran,项目名称:Kytten,代码行数:26,代码来源:override.py
示例2: __init__
def __init__(self, rows, columns, n_apples, *args, **kwargs):
super(PygletEngine, self).__init__(rows, columns, n_apples, *args, **kwargs)
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
pyglet.clock.schedule_interval(lambda t: self.update_snakes(), 1/30.0)
开发者ID:matts1,项目名称:Snakegame,代码行数:7,代码来源:pyglet.py
示例3: __init__
def __init__(self, *args, **kwargs):
super(VIctorApp, self).__init__(640, 400, caption="victor")
self.set_default_options()
self.mode = vmode.NORMAL
self.down_action = None
self.text_event = None
self.batch = pyglet.graphics.Batch()
self.setup_cursor()
self.marks = dict()
self.command_area = CommandArea(0, 0, 550, self.batch)
self.keystrokes = Keystrokes(550, 0, 70, self.batch)
self.current_multiplier = None
self.normal_dispatcher = vnd.construct_dispatcher(self)
self.set_ex_commands()
self.groups = self.current_group = PathGroup()
self.current_path = None
self.time = time.time()
pyglet.clock.schedule_interval(self.on_timer_fire, 0.05)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
gl.glEnable(gl.GL_BLEND)
开发者ID:robotbill,项目名称:VIctor,代码行数:30,代码来源:app.py
示例4: circle
def circle(pos, radius, color=(1.0,1.0,1.0), alpha=1.0,segments=6):
"""
Draws a circle with gluDisk
:param pos: center of the circle
:type pos: 2-float tuple
:param radius: radius of the circle
:type radius: float
:param color: the color in [0..1] range
:type color: 3-float tuple
:param alpha: the alpha value in [0..1] range
:param segments: number of segments
:type segments: int
"""
glDisable(GL_TEXTURE_2D)
c = gluNewQuadric()
glColor4f(color[0], color[1], color[2], alpha)
glPushMatrix()
glTranslatef(pos[0], pos[1], 0)
gluDisk(c, 0, radius, segments, 1)
glPopMatrix()
glColor4f(1.0,1.0,1.0,1.0)
glEnable(GL_TEXTURE_2D)
开发者ID:xoryouyou,项目名称:NetArgos,代码行数:30,代码来源:pool.py
示例5: enable_states
def enable_states(gl_states):
"""Context Manager that calls glEnable and glDisable on a list of gl states."""
for state in gl_states:
gl.glEnable(state)
yield
for state in gl_states:
gl.glDisable(state)
开发者ID:NicolasKuske,项目名称:ratcave,代码行数:7,代码来源:gl.py
示例6: texture_from_data
def texture_from_data(internalformat, size, data_format, data_type, data):
'''Create texture from a data buffer (whatever can be passed as pointer to ctypes)
internalformat - GL_RGBA8 or GL_RGB8 recommended
size - a 1-, 2- or 3-tuple describing the image sizes
data_format - see 'format' parameter of glDrawPixels
data_type - see 'type' parameter of glDrawPixels
data - pointer to memory'''
size = list(size)
dimensions = len(size)
binding = getattr(gl, 'GL_TEXTURE_BINDING_{0:d}D'.format(dimensions))
target = getattr(gl,'GL_TEXTURE_{0:d}D'.format(dimensions))
texImage = getattr(gl,'glTexImage{0:d}D'.format(dimensions))
oldbind = ctypes.c_uint(0)
gl.glGetIntegerv(binding, ctypes.cast(ctypes.byref(oldbind), ctypes.POINTER(ctypes.c_int)))
texid = ctypes.c_uint(0)
gl.glEnable(target)
gl.glGenTextures(1, ctypes.byref(texid))
gl.glBindTexture(target, texid)
gl.glTexParameteri(target, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR)
gl.glTexParameteri(target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR)
args = [target, 0, internalformat] + size + [0, data_format, data_type, data]
texImage(*args)
gl.glBindTexture(target, oldbind)
return texid
开发者ID:moshev,项目名称:project-viking,代码行数:27,代码来源:sprite.py
示例7: draw
def draw(self, scale, pos):
LINE_COLOUR = (255, 255, 255)
# gl.glEnable(gl.GL_DEPTH_TEST);
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
gl.glEnable(gl.GL_LINE_SMOOTH)
gl.glHint(gl.GL_LINE_SMOOTH_HINT, gl.GL_DONT_CARE)
gl.glBegin(gl.GL_LINES)
for link in self.links:
if link.highlight:
gl.glColor3ub(*self.colour)
gl.glColor3ub(*self.colour)
else:
gl.glColor3ub(*LINE_COLOUR)
gl.glColor3ub(*LINE_COLOUR)
if link.highlight:
depth = 0.5
else:
depth = 0.5
gl.glVertex3f(*util.add_tup(pos, util.scale_tup(link.points[0].pos, scale)) + (depth,))
gl.glVertex3f(*util.add_tup(pos, util.scale_tup(link.points[1].pos, scale)) + (depth,))
print util.add_tup(pos, util.scale_tup(link.points[0].pos, scale))
gl.glEnd()
开发者ID:Hugoagogo,项目名称:squiglet,代码行数:25,代码来源:__init__.py
示例8: main
def main():
global gJoyStick
global show
gl.glClearColor(0.0, 0.0, 0.0, 0.0)
gl.glEnable( gl.GL_BLEND)
gl.glBlendFunc( gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
#pyglet.clock.set_fps_limit(60)
pyglet.clock.schedule_interval(update, 1/30.)
window.set_vsync(True)
for x in pyglet.input.get_joysticks():
#readStick(x)
pass
gJoyStick = pyglet.input.get_joysticks()[0]
gJoyStick.open()
for x in gJoyStick.device.get_controls():
#print x
pass
if len(sys.argv) > 1 and sys.argv[1] == '-b':
show = 'buttons'
else:
show = 'axes'
pyglet.app.run()
print ""
开发者ID:sergio-py2,项目名称:meteor,代码行数:33,代码来源:joystick.py
示例9: set_state
def set_state(self):
gl.glPushMatrix()
gl.glMultMatrixf(rendering.matrix_to_gl(self.transform))
if self.texture:
gl.glEnable(self.texture.target)
gl.glBindTexture(self.texture.target, self.texture.id)
开发者ID:mikedh,项目名称:trimesh,代码行数:7,代码来源:widget.py
示例10: draw_bounding_box
def draw_bounding_box(self, x, y, screen_height):
bb = self.get_bounding_box()
bb = [bb['min_x'], bb['min_y'], bb['max_x'], bb['max_y']]
vertices = ()
for _ in bb:
vertices += (_.x,)
vertices += (screen_height - _.y,)
# get opengl vertices of type GLfloat
vertices_gl = (GLfloat * len(vertices))(*vertices)
# set the color
glColor4ub(0, 255, 0, 255);
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
# turn on blend for alpha channel
glEnable(GL_BLEND)
# tell open GL were passing a vertex array
glEnableClientState(GL_VERTEX_ARRAY)
# create a pointer to vertices_gl
glVertexPointer(2, GL_FLOAT, 0, vertices_gl)
# draw the array
glDrawArrays(GL_POLYGON, 0, len(vertices) // 2)
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
开发者ID:bm1362,项目名称:atlas-py,代码行数:28,代码来源:RigidBody.py
示例11: on_draw
def on_draw(self):
self.window.clear()
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glPushMatrix()
gl.glLoadIdentity()
self.camera()
gl.glEnable(self.grass.target)
gl.glEnable(gl.GL_BLEND)
gl.glBindTexture(self.grass.target, self.grass.id)
W = 10000.
graphics.draw(4, gl.GL_QUADS,
('v2f', (-W, -W, W, -W, W, W, -W, W)),
('t2f', (0., 0., W*5., 0., W*5., W*5., 0., W*5.))
)
gl.glDisable(self.grass.target)
for lane in self.lanes:
self.draw_lane_surface(lane)
for lane in self.lanes:
self.draw_lane_lines(lane)
for obj in self.objects:
self.draw_object(obj)
for car in self.cars:
if car!=self.main_car and car not in self.visible_cars:
self.draw_car(self.anim_x[car], car.color)
if self.heat is not None:
self.draw_heatmap()
for car in self.cars:
if car==self.main_car or car in self.visible_cars:
self.draw_car(self.anim_x[car], car.color)
gl.glPopMatrix()
if isinstance(self.main_car, Car):
self.label.text = 'Speed: %.2f'%self.anim_x[self.main_car][3]
self.label.draw()
if self.output is not None:
pyglet.image.get_buffer_manager().get_color_buffer().save(self.output.format(self.frame))
开发者ID:dsadigh,项目名称:Autonomous_Driving,代码行数:35,代码来源:visualize.py
示例12: after_draw
def after_draw(self, camera):
"""Called by CocosNode when the texture is already grabbed.
The FrameBuffer will be unbound and the texture will be drawn
:Parameters:
`camera` : `Camera`
The target's camera object.
"""
# capture after drawing
self.grabber.after_render(self.texture)
# after unbinding
# set a 3d projection
self._set_3d_projection()
# and center the camera
camera.locate(force=True)
# blit
gl.glEnable(self.texture.target)
gl.glBindTexture(self.texture.target, self.texture.id)
gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)
self._blit()
gl.glPopAttrib()
gl.glDisable(self.texture.target)
开发者ID:los-cocos,项目名称:cocos,代码行数:29,代码来源:grid.py
示例13: setupOpenGL
def setupOpenGL(self):
gl.glClearColor(0., 0., 0., 1.)
gl.glColor4f(1.0, 0.0, 0.0, 0.5)
gl.glEnable(gl.GL_DEPTH_TEST)
#gl.glEnable(gl.GL_CULL_FACE)
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
开发者ID:Tythos,项目名称:hypyr,代码行数:7,代码来源:main.py
示例14: on_draw
def on_draw():
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
# Gradient sky
l, b = world_to_screen((0, 0))
r, t = world_to_screen((W, H))
horizon = 177 / 255.0, 202 / 255.0, 1.0
zenith = 68 / 255.0, 0.5, 1.0
pyglet.graphics.draw(4, gl.GL_QUADS,
('v2f', [l, b, l, t, r, t, r, b]),
('c3f', sum([horizon, zenith, zenith, horizon], ())),
)
cx, cy = camera
tx, ty = world_to_screen((-cx + W * 0.5, -cy + H * 0.5))
gl.glTranslatef(tx, ty, 0)
batch.draw()
# Water
l, b = world_to_screen((0, 0))
r, t = world_to_screen((1000, WATER_LEVEL))
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
pyglet.graphics.draw(4, gl.GL_QUADS,
('v2f', [l, b, l, t, r, t, r, b]),
('c4f', [0, 0.2, 0.8, 0.5] * 4),
)
开发者ID:ChunyangSun,项目名称:VisionAndPhysicsEngine,代码行数:28,代码来源:combined.py
示例15: render
def render(self, geometry):
""" Add the sphere to the view.
:param scene: The view to render the model into
:type scene: pyglet_helper.objects.View
"""
# Renders a simple sphere with the #2 level of detail.
if self.radius == 0.0:
return
self.init_model(geometry)
coverage_levels = [30, 100, 500, 5000]
lod = self.lod_adjust(geometry, coverage_levels, self.pos, self.radius)
gl.glPushMatrix()
self.model_world_transform(geometry.gcf, self.scale).gl_mult()
self.color.gl_set(self.opacity)
if self.translucent:
# Spheres are convex, so we don't need to sort
gl.glEnable(gl.GL_CULL_FACE)
# Render the back half (inside)
gl.glCullFace(gl.GL_FRONT)
geometry.sphere_model[lod].gl_render()
# Render the front half (outside)
gl.glCullFace(gl.GL_BACK)
geometry.sphere_model[lod].gl_render()
else:
# Render a simple sphere.
geometry.sphere_model[lod].gl_render()
gl.glPopMatrix()
开发者ID:encukou,项目名称:pyglet_helper,代码行数:33,代码来源:sphere.py
示例16: draw
def draw(self):
if self._dirty:
self._context = Context()
self._parts = []
self.free()
self.render()
self.build_vbo()
self._dirty = False
# set
gl.glEnable(self._texture.target)
gl.glBindTexture(self._texture.target, self._texture.id)
gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
gl.glPushMatrix()
self.transform()
# cuadric.begin()
self._vertex_list.draw(gl.GL_TRIANGLES)
# cuadric.end()
# unset
gl.glPopMatrix()
gl.glPopAttrib()
gl.glDisable(self._texture.target)
开发者ID:1414648814,项目名称:cocos,代码行数:27,代码来源:draw.py
示例17: set_state
def set_state(self):
"""
Ensure that blending is set.
"""
gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_CURRENT_BIT)
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
开发者ID:Norberg,项目名称:pyglet-gui,代码行数:7,代码来源:manager.py
示例18: rect
def rect(a, b, color=(1.0,1.0,1.0), alpha=1.0):
"""
Draws a rectangle in the plane spanned by a,b with GL_QUADS
:param a: Point a
:type a: 2-float tuple
:param b: Point b
:type b: 2-float tuple
:param color: the color in [0..1] range
:type color: 3-float tuple
:param aa: Anti aliasing Flag
:param alpha: the alpha value in [0..1] range
"""
glDisable(GL_TEXTURE_2D)
glBegin(GL_QUADS)
glVertex3f(a[0], a[1], 0)
glVertex3f(b[0], a[1], 0)
glVertex3f(b[0], b[1], 0)
glVertex3f(a[0], b[1], 0)
glEnd()
glEnable(GL_TEXTURE_2D)
glColor4f(color+(alpha,))
开发者ID:xoryouyou,项目名称:NetArgos,代码行数:30,代码来源:glutil.py
示例19: _draw_wireframe_display_list
def _draw_wireframe_display_list(self, dl):
pgl.glPushAttrib(pgl.GL_ENABLE_BIT | pgl.GL_POLYGON_BIT)
pgl.glPolygonMode(pgl.GL_FRONT_AND_BACK, pgl.GL_LINE)
pgl.glEnable(pgl.GL_POLYGON_OFFSET_LINE)
pgl.glPolygonOffset(-0.005, -50.0)
pgl.glCallList(dl)
pgl.glPopAttrib()
开发者ID:bjodah,项目名称:sympy,代码行数:7,代码来源:plot_mode_base.py
示例20: render
def render(self, scene):
"""Add the cone to the scene.
:param scene: The view to render the model into
:type scene: pyglet_helper.objects.View
"""
if self.radius == 0:
return
self.init_model(scene)
coverage_levels = [10, 30, 90, 250, 450]
lod = self.lod_adjust(scene, coverage_levels, self.pos, self.radius)
length = self.axis.mag()
gl.glPushMatrix()
self.model_world_transform(scene.gcf, Vector([length, self.radius,
self.radius])).gl_mult()
self.color.gl_set(self.opacity)
if self.translucent:
gl.glEnable(gl.GL_CULL_FACE)
# Render the back half.
gl.glCullFace(gl.GL_FRONT)
scene.cone_model[lod].gl_render()
# Render the front half.
gl.glCullFace(gl.GL_BACK)
scene.cone_model[lod].gl_render()
else:
scene.cone_model[lod].gl_render()
gl.glPopMatrix()
开发者ID:encukou,项目名称:pyglet_helper,代码行数:33,代码来源:cone.py
注:本文中的pyglet.gl.glEnable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论