Rotate 3D image batches to make them 2D

2019-07-27 05:46发布

My on_draw function is:

def on_draw(self):
    self.clear()
    self.set3d()
    glPushMatrix()
    glRotatef(-rot[0], 1, 0, 0)
    glRotatef(-rot[1], 0, 1, 0)
    glTranslatef(-pos[0],-pos[1],-pos[2],)
    self.model.draw()
    glPopMatrix()

pos (position) and rot (rotation) are lists of camera information used to transform the graphics. What I want to achieve is a doom-like effect where the images (certain parts of the scenery, players, enemy images) are kept so that they are parallel to the screen; they stay 2D, regardless of their position in relation to the camera. Note that they should still move around with the rest of the 3D graphics.

0条回答
登录 后发表回答