Python OpenGL.GL.GL_UNSIGNED_INT Examples
The following are 3
code examples of OpenGL.GL.GL_UNSIGNED_INT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
OpenGL.GL
, or try the search function
.
Example #1
Source File: tracked_devices_actor.py From pyopenvr with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #2
Source File: test_opengl2.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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));
Example #3
Source File: rendering.py From renpy-shader with MIT License | 4 votes |
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")