Does pyGame do 3d?

前端 未结 11 909
醉话见心
醉话见心 2020-12-29 21:45

I can\'t seem to find the answer to this question anywhere. I realise that you have to use pyOpenGL or something similar to do openGL stuff, but I was wondering if its possi

11条回答
  •  难免孤独
    2020-12-29 21:52

    Pygame was never originally meant to do 3d, but there is a way you can do 3d with any 2d graphics library. All you need is the following function, which converts 3d points to 2d points, which allows you to make any 3d shape by just drawing lines on a screen.

    def convert_to_2d(point=[0,0,0]):
        return [point[0]*(point[2]*.3),point[1]*(point[2]*.3)]
    

    This is called pseudo 3d, or 2.5d. This can be done, but may be slow, and is extremely difficult to do, so it is suggested that you use a library meant for 3d.

提交回复
热议问题