Beispiel #1
0
    def acquire_color_array(self, access=GL_WRITE_ONLY):
        """ Note: Mesh.release_color_array() must be called once the buffer is no longer needed """

        size = 4 if self.use_rgba else 3

        glBindBuffer(GL_ARRAY_BUFFER, self.color_buffer)
        return map_buffer(GL_ARRAY_BUFFER, numpy.float32, access,
                          self.num_vertices * size * sizeof(GLfloat))
Beispiel #2
0
 def acquire_value_array(self, access=GL_WRITE_ONLY):
     glBindBuffer(GL_ARRAY_BUFFER, self.value_buffer)
     return map_buffer(
         GL_ARRAY_BUFFER, GLfloat, access,
         self.num_vertices * self.value_size * sizeof(GLfloat))
Beispiel #3
0
 def acquire_instance_array(self, access=GL_WRITE_ONLY):
     glBindBuffer(GL_ARRAY_BUFFER, self.instance_buffer)
     return map_buffer(
         GL_ARRAY_BUFFER, numpy.float32, access,
         self.max_instances * self.instance_buffer_size * sizeof(GLfloat))
Beispiel #4
0
 def acquire_texcoords_array(self, access=GL_WRITE_ONLY):
     glBindBuffer(GL_ARRAY_BUFFER, self.texcoords_buffer)
     return map_buffer(GL_ARRAY_BUFFER, numpy.float32, access,
                       self.num_vertices * 2 * sizeof(GLfloat))
Beispiel #5
0
    def acquire_normal_array(self, access=GL_WRITE_ONLY):
        """ Note: Mesh.release_normal_array() must be called once the buffer is no longer needed """

        glBindBuffer(GL_ARRAY_BUFFER, self.normal_buffer)
        return map_buffer(GL_ARRAY_BUFFER, numpy.float32, access,
                          self.num_vertices * 3 * sizeof(GLfloat))
Beispiel #6
0
    def acquire_index_array(self, access=GL_WRITE_ONLY):
        """ Note: Mesh.release_index_array() must be called once the buffer is no longer needed """

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.index_buffer)
        return map_buffer(GL_ELEMENT_ARRAY_BUFFER, numpy.uint32, access,
                          self.num_indices * sizeof(c_uint))