本文整理汇总了Python中OpenGL.GL.GL_UNSIGNED_INT属性的典型用法代码示例。如果您正苦于以下问题:Python GL.GL_UNSIGNED_INT属性的具体用法?Python GL.GL_UNSIGNED_INT怎么用?Python GL.GL_UNSIGNED_INT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类OpenGL.GL
的用法示例。
在下文中一共展示了GL.GL_UNSIGNED_INT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_gl
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_UNSIGNED_INT [as 别名]
def display_gl(self, modelview, projection, pose):
if not self.model_is_loaded:
self._try_load_model()
return
if not self.texture_is_loaded:
self._try_load_texture()
return
controller_X_room = pose.mDeviceToAbsoluteTracking
controller_X_room = matrixForOpenVrMatrix(controller_X_room)
modelview0 = controller_X_room * modelview
# Repack before use, just in case
modelview0 = numpy.asarray(numpy.matrix(modelview0, dtype=numpy.float32))
GL.glUniformMatrix4fv(4, 1, False, modelview0)
normal_matrix = numpy.asarray(controller_X_room)
GL.glUniformMatrix4fv(8, 1, False, normal_matrix)
GL.glActiveTexture(GL.GL_TEXTURE0)
GL.glBindTexture(GL.GL_TEXTURE_2D, self.diffuse_texture)
GL.glBindVertexArray(self.vao)
GL.glDrawElements(GL.GL_TRIANGLES, len(self.indexPositions), GL.GL_UNSIGNED_INT, None)
GL.glBindVertexArray(0)
示例2: paintGL
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_UNSIGNED_INT [as 别名]
def paintGL(self):
self.makeCurrent()
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
self.program.bind()
self.program.enableAttributeArray("position")
self.vbo.bind()
gl.glVertexAttribPointer(self.program.attributeLocation("position"), 2, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo)
self.program.enableAttributeArray("color")
self.vbo_cols.bind()
gl.glVertexAttribPointer(self.program.attributeLocation("color"), 3, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo_cols)
self.vbo_index.bind()
#gl.glDrawArrays(gl.GL_TRIANGLES, 0, len(self.data))
gl.glDrawElements(gl.GL_TRIANGLES, len(self.index), gl.GL_UNSIGNED_INT, None)
print(self.context().format().majorVersion())
print(self.context().format().minorVersion())
print(gl.glGetString(gl.GL_VERSION));
示例3: renderBoneTransform
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_UNSIGNED_INT [as 别名]
def renderBoneTransform(self, transform, context):
bone = transform.bone
mesh = bone.mesh
if not bone.image or not mesh:
#No image or mesh attached
return
if not bone.visible or transform.transparency >= 1.0:
#Nothing to draw
return
tex = self.skinTextures.textures[bone.image.name]
texInfluence = self.skinTextures.textures.get(self.getInfluenceName(bone.image.name))
if not texInfluence:
texInfluence = self.skinTextures.textures[self.BLACK_TEXTURE]
self.shader.uniformi(shader.TEX0, 0)
tex.texture.bind(0)
self.shader.uniformi(shader.TEX1, 1)
texInfluence.texture.bind(1)
self.shader.uniformMatrix4f(shader.PROJECTION, self.getProjection())
self.bindAttributeArray(self.shader, "inVertex", mesh.vertices, 2)
self.bindAttributeArray(self.shader, "inUv", mesh.uvs, 2)
self.bindAttributeArray(self.shader, "inBoneWeights", mesh.boneWeights, 4)
self.bindAttributeArray(self.shader, "inBoneIndices", mesh.boneIndices, 4)
self.shader.uniformf("wireFrame", 0)
self.shader.uniformf("boneAlpha", max(1.0 - transform.transparency, 0))
gl.glDrawElements(gl.GL_TRIANGLES, len(mesh.indices), gl.GL_UNSIGNED_INT, mesh.indices)
if bone.wireFrame:
self.shader.uniformf("wireFrame", 1)
self.shader.uniformf("boneAlpha", 1.0)
gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
gl.glDrawElements(gl.GL_TRIANGLES, len(mesh.indices), gl.GL_UNSIGNED_INT, mesh.indices)
gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
self.unbindAttributeArray(self.shader, "inVertex")
self.unbindAttributeArray(self.shader, "inUv")
self.unbindAttributeArray(self.shader, "inBoneWeights")
self.unbindAttributeArray(self.shader, "inBoneIndices")