当前位置: 首页>>代码示例>>Python>>正文


Python gl.glBlendFunc函数代码示例

本文整理汇总了Python中pyglet.gl.glBlendFunc函数的典型用法代码示例。如果您正苦于以下问题:Python glBlendFunc函数的具体用法?Python glBlendFunc怎么用?Python glBlendFunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了glBlendFunc函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: 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

示例2: setup

def setup():
    """ Basic OpenGL configuration.

    """
    # Set the color of "clear", i.e. the sky, in rgba.
    gl.glClearColor(0.5, 0.69, 1.0, 1)
    # Enable culling (not rendering) of back-facing facets -- facets that aren't
    # visible to you.
    gl.glEnable(gl.GL_CULL_FACE)

    #gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_DST_ALPHA)
    #gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
    gl.glBlendFunc(gl.GL_ZERO, gl.GL_SRC_COLOR)
    gl.glEnable(gl.GL_BLEND)
    gl.glAlphaFunc(gl.GL_GREATER, 0.5);
    gl.glEnable(gl.GL_ALPHA_TEST);
    # Set the texture minification/magnification function to GL_NEAREST (nearest
    # in Manhattan distance) to the specified texture coordinates. GL_NEAREST
    # "is generally faster than GL_LINEAR, but it can produce textured images
    # with sharper edges because the transition between texture elements is not
    # as smooth."
    gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST)
    gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
    gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_MODULATE)
    setup_fog()
开发者ID:spillz,项目名称:minepy,代码行数:25,代码来源:main.py

示例3: 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

示例4: init_gl

    def init_gl(self):
        gl.glClearColor(.93, .93, 1, 1)
        #glColor3f(1, 0, 0)

        gl.glEnable(gl.GL_DEPTH_TEST)
        gl.glEnable(gl.GL_CULL_FACE)
        gl.glEnable(gl.GL_LIGHTING)
        gl.glEnable(gl.GL_LIGHT0)
        gl.glEnable(gl.GL_LIGHT1)

        gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, _gl_vector(.5, .5, 1, 0))
        gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPECULAR, _gl_vector(.5, .5, 1, 1))
        gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, _gl_vector(1, 1, 1, 1))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_POSITION, _gl_vector(1, 0, .5, 0))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_DIFFUSE, _gl_vector(.5, .5, .5, 1))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_SPECULAR, _gl_vector(1, 1, 1, 1))

        gl.glColorMaterial(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT_AND_DIFFUSE)
        gl.glEnable(gl.GL_COLOR_MATERIAL)
        gl.glShadeModel(gl.GL_SMOOTH)

        gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, _gl_vector(0.192250, 0.192250, 0.192250))
        gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, _gl_vector(0.507540, 0.507540, 0.507540))
        gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, _gl_vector(.5082730,.5082730,.5082730))

        gl.glMaterialf(gl.GL_FRONT, gl.GL_SHININESS, .4 * 128.0);

        gl.glEnable(gl.GL_BLEND) 
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) 
开发者ID:embr,项目名称:trimesh,代码行数:29,代码来源:viewer.py

示例5: 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

示例6: __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

示例7: 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

示例8: 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

示例9: 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

示例10: __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

示例11: 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


注:本文中的pyglet.gl.glBlendFunc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。