• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python gl.glFinish函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _test_functonality

def _test_functonality(backend):
    """ Create app and canvas so we have a context. Then run tests.
    """
    # use the backend
    gl.use_gl(backend)
    
    with Canvas() as canvas:
        _clear_screen()
        
        # Prepare
        w, h = canvas.size
        gl.glViewport(0, 0, w, h)
        gl.glScissor(0, 0, w, h)  # touch
        gl.glClearColor(0.0, 0.0, 0.0, 1.0)
        
        # Setup visualization, ensure to do it in a draw event
        objects = _prepare_vis()
        _clear_screen()
        _draw1()
        _clear_screen()
        _draw2()
        _clear_screen()
        _draw3()

        # Clean up
        for delete_func, handle in objects:
            delete_func(handle)
        gl.glFinish()
开发者ID:alexflint,项目名称:vispy,代码行数:28,代码来源:test_functionality.py


示例2: draw00

 def draw00(event):
     print("  {0:7}: {1}".format("0", bgcolors[0]))
     if bgcolors[0] is not None:
         gl.glViewport(0, 0, *list(_win_size))
         gl.glClearColor(*bgcolors[0])
         gl.glClear(gl.GL_COLOR_BUFFER_BIT)
         gl.glFinish()
开发者ID:Zulko,项目名称:vispy,代码行数:7,代码来源:test_simultaneous.py


示例3: _draw2

def _draw2():
    # Draw using elements via buffer
    gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, helements)
    gl.glDrawElements(gl.GL_TRIANGLES, elements.size, gl.GL_UNSIGNED_BYTE, 0)
    gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, 0)
    gl.glFinish()
    _check_result()
开发者ID:alexflint,项目名称:vispy,代码行数:7,代码来源:test_functionality.py


示例4: draw11

 def draw11(event):
     print('  {0:7}: {1}'.format('1', bgcolors[1]))
     if bgcolors[1] is not None:
         gl.glViewport(0, 0, *list(_win_size))
         gl.glClearColor(*bgcolors[1])
         gl.glClear(gl.GL_COLOR_BUFFER_BIT)
         gl.glFinish()
开发者ID:Calvarez20,项目名称:vispy,代码行数:7,代码来源:test_simultaneous.py


示例5: paint0

 def paint0(event):
     print('  {0:7}: {1}'.format(backend + '_0', bgcolors[0]))
     if bgcolors[0] is not None:
         gl.glViewport(0, 0, *list(_win_size))
         gl.glClearColor(*bgcolors[0])
         gl.glClear(gl.GL_COLOR_BUFFER_BIT)
         gl.glFinish()
开发者ID:kif,项目名称:vispy,代码行数:7,代码来源:test_simultaneous.py


示例6: _test_basics

def _test_basics(backend):
    """ Create app and canvas so we have a context. Then run tests.
    """

    # use the backend
    gl.use_gl(backend)

    with Canvas():
        _test_setting_parameters()
        _test_enabling_disabling()
        _test_setting_stuff()
        _test_object_creation_and_deletion()
        _test_fbo()
        gl.glFinish()
开发者ID:shjoshi,项目名称:vispy,代码行数:14,代码来源:test_basics.py


示例7: _test_basics

def _test_basics(backend):
    """ Create app and canvas so we have a context. Then run tests.
    """

    # use the backend
    with use_log_level('error', print_msg=False):
        gl.use_gl(backend)  # pyopengl throws warning on injection

    with Canvas():
        _test_setting_parameters()
        _test_enabling_disabling()
        _test_setting_stuff()
        _test_object_creation_and_deletion()
        _test_fbo()
        gl.glFinish()
开发者ID:almarklein,项目名称:vispy,代码行数:15,代码来源:test_basics.py


示例8: test_basics_desktop

def test_basics_desktop():
    """ Test desktop GL backend for basic functionality. """
    _test_basics('gl2')
    with Canvas():
        _test_setting_parameters()
        _test_enabling_disabling()
        _test_setting_stuff()
        _test_object_creation_and_deletion()
        _test_fbo()
        try:
            gl.gl2._get_gl_func('foo', None, ())
        except RuntimeError as exp:
            exp = str(exp)
            assert 'version' in exp
            assert 'unknown' not in exp
        gl.glFinish()
开发者ID:Calvarez20,项目名称:vispy,代码行数:16,代码来源:test_basics.py


示例9: _clear_screen

def _clear_screen():
    gl.glClear(gl.GL_COLOR_BUFFER_BIT)
    gl.glFinish()
开发者ID:alexflint,项目名称:vispy,代码行数:3,代码来源:test_functionality.py


示例10: _draw3

def _draw3():
    # Draw using elements via numpy array
    gl.glDrawElements(gl.GL_TRIANGLES, 
                      elements.size, gl.GL_UNSIGNED_BYTE, elements)
    gl.glFinish()
    _check_result()
开发者ID:alexflint,项目名称:vispy,代码行数:6,代码来源:test_functionality.py


示例11: _draw1

def _draw1():
    # Draw using arrays
    gl.glDrawArrays(gl.GL_TRIANGLES, 0, N)
    gl.glFinish()
    _check_result()
开发者ID:alexflint,项目名称:vispy,代码行数:5,代码来源:test_functionality.py


示例12: _prepare_vis


#.........这里部分代码省略.........
    
    # Select no FBO
    gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
    
    # Attach!
    loc = gl.glGetAttribLocation(hprog, 'a_4')
    gl.glEnableVertexAttribArray(loc)
    gl.glVertexAttribPointer(loc, 4, gl.GL_FLOAT, False, 4*4, buf4)
    
    # Check if all is ok
    assert_equal(gl.glGetError(), 0)
    
    # --- element buffer
    
    # Create buffer
    global helements
    helements = gl.glCreateBuffer()
    objects.append((gl.glDeleteBuffer, helements))
    gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, helements)

    # Allocate and set data
    gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, elements, gl.GL_DYNAMIC_DRAW)
    gl.glBufferSubData(gl.GL_ELEMENT_ARRAY_BUFFER, 0, elements)
    
    # Turn off
    gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, 0)
    
    # Check if all is ok
    assert_equal(gl.glGetError(), 0)
    
    # --- uniforms
    
    # Set integer uniforms to 0
    # We set them twice just to touch both i and iv functions
    for i, fun1, fun2 in [(1, gl.glUniform1i, gl.glUniform1iv),
                          (2, gl.glUniform2i, gl.glUniform2iv),
                          (3, gl.glUniform3i, gl.glUniform3iv),
                          (4, gl.glUniform4i, gl.glUniform4iv)]:
        name = 'u_i%i' % i
        value = [0] * i
        loc = gl.glGetUniformLocation(hprog, name)
        fun1(loc, *value)  # e.g. glUniform4i
        fun2(loc, 1, value)  # e.g. glUniform4iv

    # Set float uniforms to 1.0
    # We set them twice just to touch both i and iv functions
    for i, fun1, fun2 in [(1, gl.glUniform1f, gl.glUniform1fv),
                          (2, gl.glUniform2f, gl.glUniform2fv),
                          (3, gl.glUniform3f, gl.glUniform3fv),
                          (4, gl.glUniform4f, gl.glUniform4fv)]:
        name = 'u_f%i' % i
        value = [1.0] * i
        loc = gl.glGetUniformLocation(hprog, name)
        fun1(loc, *value)  # e.g. glUniform4f
        fun2(loc, 1, value)  # e.g. glUniform4fv
    
    # Set matrix uniforms
    m = np.eye(5, dtype='float32')
    loc = gl.glGetUniformLocation(hprog, 'u_m2')
    gl.glUniformMatrix2fv(loc, 1, False, m[:2, :2])
    #
    loc = gl.glGetUniformLocation(hprog, 'u_m3')
    m = np.eye(3, dtype='float32')
    gl.glUniformMatrix3fv(loc, 1, False, m[:3, :3])
    #
    loc = gl.glGetUniformLocation(hprog, 'u_m4')
    m = np.eye(4, dtype='float32')
    gl.glUniformMatrix4fv(loc, 1, False, m[:4, :4])
    
    # Check some uniforms
    loc = gl.glGetUniformLocation(hprog, 'u_i1')
    assert_equal(gl.glGetUniform(hprog, loc), 0)
    loc = gl.glGetUniformLocation(hprog, 'u_i2')
    assert_equal(gl.glGetUniform(hprog, loc), (0, 0))
    loc = gl.glGetUniformLocation(hprog, 'u_f2')
    assert_equal(gl.glGetUniform(hprog, loc), (1.0, 1.0))
    
    # Check if all is ok
    assert_equal(gl.glGetError(), 0)
    
    # --- attributes 
    
    # Constant values for attributes. We do not even use this ...
    loc = gl.glGetAttribLocation(hprog, 'a_1')
    gl.glVertexAttrib1f(loc, 1.0)
    loc = gl.glGetAttribLocation(hprog, 'a_2')
    gl.glVertexAttrib2f(loc, 1.0, 1.0)
    loc = gl.glGetAttribLocation(hprog, 'a_3')
    gl.glVertexAttrib3f(loc, 1.0, 1.0, 1.0)
    loc = gl.glGetAttribLocation(hprog, 'a_4')
    gl.glVertexAttrib4f(loc, 1.0, 1.0, 1.0, 1.0)
    
    # --- flush and finish
    
    # Not really necessary, but we want to touch the functions
    gl.glFlush()
    gl.glFinish()
    
    #print([i[1] for i in objects])
    return objects
开发者ID:alexflint,项目名称:vispy,代码行数:101,代码来源:test_functionality.py


示例13: _vispy_swap_buffers

 def _vispy_swap_buffers(self):
     if self._pixels is None:
         raise RuntimeError('No pixel buffer')
     gl.glFinish()
开发者ID:NoriVicJr,项目名称:vispy,代码行数:4,代码来源:_osmesa.py


示例14: paint

 def paint(event):
     print('  {0:7}: {1}'.format(backend, bgcolor[backend]))
     gl.glViewport(0, 0, *list(_win_size))
     gl.glClearColor(*bgcolor[backend])
     gl.glClear(gl.GL_COLOR_BUFFER_BIT)
     gl.glFinish()
开发者ID:kif,项目名称:vispy,代码行数:6,代码来源:test_simultaneous.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gl.glViewport函数代码示例发布时间:2022-05-26
下一篇:
Python gl.glEnable函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap