本文整理汇总了Python中OpenGL.arrays.vbo.VBO.copy_data方法的典型用法代码示例。如果您正苦于以下问题:Python VBO.copy_data方法的具体用法?Python VBO.copy_data怎么用?Python VBO.copy_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.arrays.vbo.VBO
的用法示例。
在下文中一共展示了VBO.copy_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RectAlignmentControllerView
# 需要导入模块: from OpenGL.arrays.vbo import VBO [as 别名]
# 或者: from OpenGL.arrays.vbo.VBO import copy_data [as 别名]
#.........这里部分代码省略.........
if always_above:
if numpy.cross(Vec2(1,0), normal) > 0:
normal = -normal
res = numpy.array([
a + normal * 8,
a + normal * 20,
a + normal * 15,
b + normal * 15,
b + normal * 8,
b + normal * 20,
])
return res
def render(self, vs):
self.viewState = vs
disabled = not self.active or self.model_overall.view_mode
# Perimeter is defined by the first 4 handles
self.vbo_per_dim_ar["vertex"][:4] = [self.im2V(pt) for pt in self.model.align_handles[:4]]
# Generate the dimension lines. For ease of use, we always draw the dim-lines above when dims are manual
# or below when dims are unlocked
self.vbo_per_dim_ar["vertex"][4:10] = self.gen_dim(0, not self.model.dims_locked)
self.vbo_per_dim_ar["vertex"][10:16] = self.gen_dim(2, not self.model.dims_locked)
self.vbo_per_dim.set_array(self.vbo_per_dim_ar)
# Ugh..... PyOpenGL isn't smart enough to bind the data when it needs to be copied
with self.vbo_per_dim:
self.vbo_per_dim.copy_data()
GL.glDisable(GL.GL_BLEND)
# ... and draw the perimeter
with self.vao_per_dim, self.prog:
GL.glUniformMatrix3fv(self.mat_loc, 1, True, self.viewState.glWMatrix.astype(numpy.float32))
# Draw the outer perimeter
if disabled:
GL.glUniform4f(self.col_loc, 0.8, 0.8, 0.8, 1)
else:
GL.glUniform4f(self.col_loc, 0.8, 0.8, 0, 1)
GL.glDrawArrays(GL.GL_LINE_LOOP, 0, 4)
# Draw the dimensions
GL.glUniform4f(self.col_loc, 0.8, 0.0, 0.0, 1)
GL.glDrawArrays(GL.GL_LINES, 4, 6)
GL.glUniform4f(self.col_loc, 0.0, 0.0, 0.8, 1)
GL.glDrawArrays(GL.GL_LINES, 10, 6)
if disabled:
return
# Now draw a handle at each corner
with self.vao_handles, self.prog:
for n, i in enumerate(self.model.align_handles):
# skip nonexistent handles
if i is None:
continue