def draw_object():
    glVertexAttribPointer(locations[b"vertex"], 3, GL_FLOAT, False, record_len,
                          vertex_offset)
    glVertexAttribPointer(locations[b"tex_coord"], 3, GL_FLOAT, False,
                          record_len, tex_coord_offset)
    glVertexAttribPointer(locations[b"normal"], 3, GL_FLOAT, False, record_len,
                          normal_offset)
    glVertexAttribPointer(locations[b"color"], 3, GL_FLOAT, False, record_len,
                          color_offset)

    modelview = m.identity()
    modelview = m.mul(modelview, m.scale(scale, scale, scale))
    modelview = m.mul(modelview, q.matrix(rotation))
    glUniformMatrix4fv(locations[b"modelview_matrix"], 1, GL_FALSE,
                       c_matrix(modelview))

    normal = m.transpose(m.inverse(m.top_left(modelview)))
    glUniformMatrix3fv(locations[b"normal_matrix"], 1, GL_FALSE,
                       c_matrix(normal))

    offset = 0
    for size in sizes:
        glDrawElements(GL_TRIANGLE_STRIP, size, GL_UNSIGNED_INT,
                       c_void_p(offset))
        offset += size * uint_size
def draw_object():
    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glScale(scale, scale, scale)
    glMultMatrixf(m.column_major(q.matrix(rotation)))
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    glCallList(display_list)
    glPopMatrix()
Example #3
0
def draw_object():
	glMatrixMode(GL_MODELVIEW)
	glPushMatrix()
	glScale(scale, scale, scale)
	glMultMatrixf(m.column_major(q.matrix(rotation)))
	
	glCallList(object_list_id)
	
	glPopMatrix()
def draw_object():
    glVertexPointer(3, GL_FLOAT, 0, verticies)
    glTexCoordPointer(3, GL_FLOAT, 0, tex_coords)
    glNormalPointer(GL_FLOAT, 0, normals)
    glColorPointer(3, GL_FLOAT, 0, colors)

    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glScale(scale, scale, scale)
    glMultMatrixf(m.column_major(q.matrix(rotation)))

    offset = 0
    for size in sizes:
        glDrawElements(GL_TRIANGLE_STRIP, size, GL_UNSIGNED_INT,
                       indicies[offset:offset + size])
        offset += size

    glPopMatrix()
def draw_object():
    glVertexPointer(3, GL_FLOAT, record_len, vertex_offset)
    glTexCoordPointer(3, GL_FLOAT, record_len, tex_coord_offset)
    glNormalPointer(GL_FLOAT, record_len, normal_offset)
    glColorPointer(3, GL_FLOAT, record_len, color_offset)

    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glScale(scale, scale, scale)
    glMultMatrixf(m.column_major(q.matrix(rotation)))

    offset = 0
    for size in sizes:
        glDrawElements(GL_TRIANGLE_STRIP, size, GL_UNSIGNED_INT,
                       c_void_p(offset))
        offset += size * uint_size

    glPopMatrix()
Example #6
0
def draw_object():
    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glScale(scale, scale, scale)
    glMultMatrixf(m.column_major(q.matrix(rotation)))

    offset = 0
    for size in sizes:
        glBegin(GL_TRIANGLE_STRIP)
        for i in range(offset, offset + size):
            index = indicies[i]
            glColor3f(*colors[index])
            glNormal3f(*normals[index])
            glTexCoord3f(*tex_coords[index])
            glVertex3f(*verticies[index])
        glEnd()
        offset += size

    glPopMatrix()
Example #7
0
def draw_object():
    glVertexAttribPointer(locations[b"vertex"], 3, GL_FLOAT, False, record_len,
                          vertex_offset)
    glVertexAttribPointer(locations[b"tex_coord"], 3, GL_FLOAT, False,
                          record_len, tex_coord_offset)
    glVertexAttribPointer(locations[b"normal"], 3, GL_FLOAT, False, record_len,
                          normal_offset)
    glVertexAttribPointer(locations[b"color"], 3, GL_FLOAT, False, record_len,
                          color_offset)

    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glScale(scale, scale, scale)
    glMultMatrixf(m.column_major(q.matrix(rotation)))

    offset = 0
    for size in sizes:
        glDrawElements(GL_TRIANGLE_STRIP, size, GL_UNSIGNED_INT,
                       c_void_p(offset))
        offset += size * uint_size

    glPopMatrix()
Example #8
0
 def compute(_):
     ''' OPTIMIZATION: factorize directly all computations in here'''
     #_.camera = _m.mul(_.camera, _m.translate(dx/100,dy/100,0))
     _.matrix = _m.mul(_m.translate(*_.position), _q.matrix(_.rotation))
Example #9
0
 def arcball(_, p0, p1):
     ''' set the rotation only according to the arcball'''
     _.rotation = _q.product(_.rotation, _q.arcball(*p0), _q.arcball(*p1))
     _.matrix = _q.matrix(_.rotation)
     '''