本文整理汇总了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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例9: _clear_screen
def _clear_screen():
gl.glClear(gl.GL_COLOR_BUFFER_BIT)
gl.glFinish()
示例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()
示例11: _draw1
def _draw1():
# Draw using arrays
gl.glDrawArrays(gl.GL_TRIANGLES, 0, N)
gl.glFinish()
_check_result()
示例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
示例13: _vispy_swap_buffers
def _vispy_swap_buffers(self):
if self._pixels is None:
raise RuntimeError('No pixel buffer')
gl.glFinish()
示例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()