本文整理汇总了Python中pyglet.gl.glScalef函数的典型用法代码示例。如果您正苦于以下问题:Python glScalef函数的具体用法?Python glScalef怎么用?Python glScalef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了glScalef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: draw
def draw(self, frame):
# The gneneral plan here is:
# 1. Get the dots in the range of 0-255.
# 2. Create a texture with the dots data.
# 3. Draw the texture, scaled up with nearest-neighbor.
# 4. Draw a mask over the dots to give them a slightly more realistic look.
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
gl.glLoadIdentity()
# Draw the dots in this color:
#gl.glColor3f(1.0, 0.5, 0.25)
gl.glScalef(1, -1, 1)
gl.glTranslatef(0, -DMD_SIZE[1]*DMD_SCALE, 0)
#data = frame.get_data_mult()
#this new jk_get_data will read the dots using the dmd function
#and convert them via the map to rGB.
data = self.jk_get_data(frame)
image = pyglet.image.ImageData(DMD_SIZE[0], DMD_SIZE[1], 'RGB', data, pitch=DMD_SIZE[0] * 3)
gl.glTexParameteri(image.get_texture().target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
image.blit(0, 0, width=DMD_SIZE[0]*DMD_SCALE, height=DMD_SIZE[1]*DMD_SCALE)
del image
gl.glScalef(DMD_SCALE/float(MASK_SIZE), DMD_SCALE/float(MASK_SIZE), 1.0)
gl.glColor4f(1.0, 1.0, 1.0, 1.0)
self.mask_texture.blit_tiled(x=0, y=0, z=0, width=DMD_SIZE[0]*MASK_SIZE, height=DMD_SIZE[1]*MASK_SIZE)
开发者ID:horseyhorsey,项目名称:SkeletonProcVisualPinball10,代码行数:33,代码来源:desktop_pyglet.py
示例2: draw
def draw(self):
if self.graph:
glPushMatrix()
glScalef(self.scale, self.scale, 1.0)
self.graph.draw()
glPopMatrix()
self.grid.batch.draw()
开发者ID:chrisbiggar,项目名称:shiny-light,代码行数:7,代码来源:scenecontroller.py
示例3: transform
def transform(self):
"""
Apply ModelView transformations.
You will most likely want to wrap calls to this function with
``glPushMatrix()``/``glPopMatrix()``
"""
x, y = director.get_window_size()
if not(self.grid and self.grid.active):
# only apply the camera if the grid is not active
# otherwise, the camera will be applied inside the grid
self.camera.locate()
gl.glTranslatef(self.position[0], self.position[1], 0)
gl.glTranslatef(self.transform_anchor_x, self.transform_anchor_y, 0)
if self.rotation != 0.0:
gl.glRotatef(-self._rotation, 0, 0, 1)
if self.scale != 1.0 or self.scale_x != 1.0 or self.scale_y != 1.0:
gl.glScalef(self._scale * self._scale_x, self._scale * self._scale_y, 1)
if self.transform_anchor != (0, 0):
gl.glTranslatef(
-self.transform_anchor_x,
-self.transform_anchor_y,
0)
开发者ID:1414648814,项目名称:cocos,代码行数:28,代码来源:cocosnode.py
示例4: draw
def draw(self):
if self.batch is not None:
glPushMatrix()
glScalef(self.scale, self.scale, 0)
self.batch.draw()
glPopMatrix()
self.grid.batch.draw()
开发者ID:chrisbiggar,项目名称:sidescrolltesting,代码行数:7,代码来源:controller.py
示例5: draw
def draw(self):
self.loadStartPosition()
gl.glRotatef(90.0, 0.0, 0.0, 1.0)
gl.glBegin(gl.GL_QUADS)
gl.glColor3f(1.0, 1.0, 0.0)
tenth = math.pi * 2.0 / 10.0
for z in [-0.1, 0.1]:
for i in xrange(5):
a = float(i) * tenth * 2.0
gl.glVertex3f(0.0, 0.0, z)
gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), z)
gl.glVertex3f(math.cos(a), math.sin(a), z)
gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), z)
for i in xrange(5):
a = float(i) * tenth * 2.0
gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), 0.1)
gl.glVertex3f(math.cos(a), math.sin(a), 0.1)
gl.glVertex3f(math.cos(a), math.sin(a), -0.1)
gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), -0.1)
gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), 0.1)
gl.glVertex3f(math.cos(a), math.sin(a), 0.1)
gl.glVertex3f(math.cos(a), math.sin(a), -0.1)
gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), -0.1)
gl.glEnd()
self.loadStartPosition()
gl.glTranslatef(0.0, 0.0, 0.1)
gl.glScalef(0.01, 0.01, 0.0)
self.label.draw()
gl.glLoadIdentity()
开发者ID:benatkin,项目名称:pyglet-stuff,代码行数:31,代码来源:goldstar.py
示例6: on_draw
def on_draw():
pyglet.clock.tick()
window.clear()
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
(w, h) = window.get_size()
gl.glScalef(
float(min(w, h))/w,
-float(min(w, h))/h,
1
)
gl.gluPerspective(45.0, 1, 0.1, 1000.0)
gl.gluLookAt(0, 0, 2.4,
0, 0, 0,
0, 1, 0)
for vision in window.visions.values():
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
vision()
buf = pyglet.image.get_buffer_manager().get_color_buffer()
rawimage = buf.get_image_data()
window.texture = rawimage.get_texture()
开发者ID:mattiabressan,项目名称:pineal,代码行数:26,代码来源:windows.py
示例7: predraw
def predraw(w,h):
gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION,vec(1,1,10, 3))
gl.glLightModelfv(
gl.GL_LIGHT_MODEL_AMBIENT|gl.GL_LIGHT_MODEL_TWO_SIDE,
vec(1,1,1, 1.0)
)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
#glOrtho(-1, 1, -1, 1, -1, 1)
#(w,h) = self.get_size()
gl.glScalef(
float(min(w,h))/w,
-float(min(w,h))/h,
1
)
gl.gluPerspective(45.0, 1, 0.1, 1000.0)
gl.gluLookAt(
camera.x,
camera.y,
camera.z,
0,0,0,
camera.up[0],
camera.up[1],
camera.up[2]
)
开发者ID:alcemirfernandes,项目名称:PinealLoopProject,代码行数:27,代码来源:windows.py
示例8: draw_objects
def draw_objects(self):
'''called in the middle of ondraw after the buffer has been cleared'''
self.create_objects()
glPushMatrix()
# Rotate according to trackball
glMultMatrixd(build_rotmatrix(self.basequat))
# Move origin to bottom left of platform
platformx0 = -self.build_dimensions[3] - self.parent.platform.width / 2
platformy0 = -self.build_dimensions[4] - self.parent.platform.depth / 2
glTranslatef(platformx0, platformy0, 0)
light_z = max(self.parent.platform.width, self.parent.platform.depth)
glLightfv(GL_LIGHT0, GL_POSITION, vec(0,
self.parent.platform.depth / 2,
light_z, 0))
glLightfv(GL_LIGHT1, GL_POSITION, vec(self.parent.platform.width,
self.parent.platform.depth / 2,
light_z, 0))
for obj in self.parent.objects:
if not obj.model \
or not obj.model.loaded \
or not obj.model.initialized:
continue
glPushMatrix()
glTranslatef(*(obj.offsets))
glTranslatef(*(obj.centeroffset))
glRotatef(obj.rot, 0.0, 0.0, 1.0)
glScalef(*obj.scale)
obj.model.display()
glPopMatrix()
glPopMatrix()
开发者ID:brodykenrick,项目名称:Printrun,代码行数:34,代码来源:gcview.py
示例9: flush_labels
def flush_labels(self):
gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
gl.glPushMatrix()
gl.glTranslatef(-self.game.camera_x * defs.WINDOW_SCALE[0],
-self.game.camera_y * defs.WINDOW_SCALE[1], 0)
for label, x, y, scale in self.labels:
if scale:
gl.glPushMatrix()
label.anchor_x = 'center'
label.anchor_y = 'center'
gl.glTranslatef(x * defs.WINDOW_SCALE[0],
y * defs.WINDOW_SCALE[1], 0)
gl.glScalef(*scale)
label.x = label.y = 0
label.draw()
gl.glPopMatrix()
else:
label.x = x * defs.WINDOW_SCALE[0]
label.y = y * defs.WINDOW_SCALE[1]
label.draw()
self.labels = []
gl.glColor3f(1, 1, 1)
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glPopMatrix()
# self.fps_label.draw()
self.game.score.draw()
开发者ID:noonat,项目名称:deathbeam,代码行数:26,代码来源:draw.py
示例10: on_draw
def on_draw(self):
self.clear()
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
(w, h) = self.get_size()
gl.glScalef(
float(min(w, h))/w,
-float(min(w, h))/h,
1
)
gl.gluPerspective(45.0, 1, 0.1, 1000.0)
gl.gluLookAt(0, 0, 2.4,
0, 0, 0,
0, 1, 0)
global render_texture
render_texture = self.texture
for v in self.visions.values():
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
v.iteration()
buf = pyglet.image.get_buffer_manager().get_color_buffer()
rawimage = buf.get_image_data()
self.texture = rawimage.get_texture()
clock.tick()
开发者ID:ff-,项目名称:pineal,代码行数:30,代码来源:windows.py
示例11: draw_objects
def draw_objects(self):
'''called in the middle of ondraw after the buffer has been cleared'''
self.create_objects()
glPushMatrix()
if self.orthographic:
glTranslatef(0, 0, -3 * self.dist) # Move back
else:
glTranslatef(0, 0, -self.dist) # Move back
# Rotate according to trackball
glMultMatrixd(build_rotmatrix(self.basequat))
# Move origin to bottom left of platform
platformx0 = -self.build_dimensions[3] - self.parent.platform.width / 2
platformy0 = -self.build_dimensions[4] - self.parent.platform.depth / 2
glTranslatef(platformx0, platformy0, 0)
for obj in self.parent.objects:
if not obj.model \
or not obj.model.loaded \
or not obj.model.initialized:
continue
glPushMatrix()
glTranslatef(*(obj.offsets))
glTranslatef(*(obj.centeroffset))
glRotatef(obj.rot, 0.0, 0.0, 1.0)
glScalef(*obj.scale)
obj.model.display()
glPopMatrix()
glPopMatrix()
开发者ID:faustreg,项目名称:Printrun,代码行数:30,代码来源:gcview.py
示例12: draw_axes
def draw_axes(self):
'draw x y z axis in r g b with text labels'
gl.glPushMatrix()
gl.glScalef( 1.1, 1.1, 1.1)
o = 0, 0, 0
x = 1, 0, 0
y = 0, 1, 0
z = 0, 0, 1
verts = numpy.array([ o, x, o, y, o, z], dtype=constants.DTYPE )
colors = numpy.array([ x, x, y, y, z, z], dtype=constants.DTYPE )
idxs = numpy.cast[constants.INTDTYPE]( numpy.mgrid[:6] )
self.drawlines( verts, colors, idxs)
def draw_axis_label( name, xyz):
'draw a single label'
gl.glPushMatrix()
gl.glTranslatef( xyz[0], xyz[1], xyz[2] )
gl.glScalef( .01, .01, .01 )
gl.glRotatef( 90, 0, 1, 0 )
gl.glRotatef( 90, 0, 0, 1 )
pyglet.text.Label(name).draw()
gl.glPopMatrix()
draw_axis_label( 'x', x)
draw_axis_label( 'y', y)
draw_axis_label( 'z', z)
gl.glPopMatrix()
开发者ID:manishjakhodecdn,项目名称:skyseam,代码行数:30,代码来源:viewer.py
示例13: draw
def draw(self, scale=1):
gl.glPushMatrix()
gl.glEnable(gl.GL_TEXTURE_2D)
gl.glTranslatef(*self.position)
gl.glRotatef(self.angle, 0, 0, 1)
gl.glScalef(scale, scale, scale)
self.batch.draw()
gl.glPopMatrix()
开发者ID:pennomi,项目名称:banneret,代码行数:8,代码来源:pieces.py
示例14: draw
def draw(self):
glPushMatrix()
glRotatef(self.angle, 0., 0., 1.)
glScalef(self.scale, 1., 1.)
glTranslatef(0., -common_res.ray.height/2, 0.)
glColor4f(1., 1., 1., self.alpha)
common_res.ray.blit(0, 0)
glPopMatrix()
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:8,代码来源:game_controls.py
示例15: draw_axis_label
def draw_axis_label( name, xyz):
'draw a single label'
gl.glPushMatrix()
gl.glTranslatef( xyz[0], xyz[1], xyz[2] )
gl.glScalef( .01, .01, .01 )
gl.glRotatef( 90, 0, 1, 0 )
gl.glRotatef( 90, 0, 0, 1 )
pyglet.text.Label(name).draw()
gl.glPopMatrix()
开发者ID:manishjakhodecdn,项目名称:skyseam,代码行数:9,代码来源:viewer.py
示例16: draw
def draw(self):
ray = L('c-ray')
glPushMatrix()
glRotatef(self.angle, 0., 0., 1.)
glScalef(self.scale, 1., 1.)
glTranslatef(0., -ray.height/2, 0.)
glColor4f(1., 1., 1., self.alpha)
ray.blit(0, 0)
glPopMatrix()
开发者ID:17night,项目名称:thbattle,代码行数:9,代码来源:game_controls.py
示例17: scale
def scale(x, y=None, z=None):
if y is None:
y, z = x, x
elif z is None:
z = 1
gl.glPushMatrix()
gl.glScalef(x, y, z)
yield
gl.glPopMatrix()
开发者ID:edne,项目名称:pineal,代码行数:10,代码来源:__init__.py
示例18: on_draw
def on_draw(self):
rendr_components, trans_components = self.entity_manager.get_all_components_of_types([Render, Transform])
for render, trans in zip(rendr_components, trans_components):
gl.glPushMatrix()
gl.glTranslatef(trans.x, trans.y, 0.0)
gl.glRotatef(trans.rotation, 0, 0, 1)
gl.glScalef(trans.scale, trans.scale, 1.0)
render.image.blit(trans.anchor_x, trans.anchor_y)
gl.glPopMatrix()
开发者ID:eeneku,项目名称:baller,代码行数:10,代码来源:render_system.py
示例19: draw
def draw(self, window):
a = self.zoom(self.timeAlive)
h = self.height(self.timeAlive)
gl.glPushMatrix()
gl.glTranslatef(self.props.windowWidth//2, h, 0)
gl.glScalef(a,a,a)
self.text.draw()
gl.glPopMatrix()
开发者ID:sergio-py2,项目名称:meteor,代码行数:11,代码来源:activeobjects.py
示例20: display
def display(self, width, height):
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
gl.glOrtho(0, width, 0, height, -1, 1)
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
gl.glTranslatef(self.trans[0], self.trans[1], 0)
gl.glScalef(self.trans[2], self.trans[2], self.trans[2])
# FIXME draw only visible part?
self.renderer.render()
开发者ID:mnzaki,项目名称:dlogical,代码行数:11,代码来源:circuit_drawing_area.py
注:本文中的pyglet.gl.glScalef函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论