Exemplo n.º 1
0
 def __init__(self):
     self.GPU = deque([
         es.toGPUShape(
             bs.createTextureCube(
                 os.path.join('mod', 'tex', 'game_over_1.png')), GL_REPEAT,
             GL_NEAREST),
         es.toGPUShape(
             bs.createTextureCube(
                 os.path.join('mod', 'tex', 'game_over_2.png')), GL_REPEAT,
             GL_NEAREST),
         es.toGPUShape(
             bs.createTextureCube(
                 os.path.join('mod', 'tex', 'game_over_3.png')), GL_REPEAT,
             GL_NEAREST),
         es.toGPUShape(
             bs.createTextureCube(
                 os.path.join('mod', 'tex', 'game_over_4.png')), GL_REPEAT,
             GL_NEAREST)
     ])
     self.x, self.y, self.z = 0, 310, 100
     self.phi = 0
     self.tick = 0
     self.s = 10
     self.transform = tr.matmul([
         tr.translate(self.x, self.y, self.z),
         tr.scale(self.s, self.s, 0.0001)
     ])
Exemplo n.º 2
0
    def __init__(self):
        self.alive = True
        self.objective = None
        self.floor = None
        self.snake_parts = [Head()]
        self.bodyTypeList = [1,0,2,3,4]
        self.weirdLight = (1.0, 1.0, 1.0)
        obj = os.path.join("objects","dummy.obj")
        bodyOBJ1 = obj_reader.readOBJ2(f'{obj}',os.path.join("objects","textures","dudeBlack.png"))
        bodyOBJ2 = obj_reader.readOBJ2(f'{obj}',os.path.join("objects","textures","dudeRed.png"))
        bodyOBJ3 = obj_reader.readOBJ2(f'{obj}',os.path.join("objects","textures","dudeWhite.png"))
        bodyOBJ4 = obj_reader.readOBJ2(f'{obj}',os.path.join("objects","textures","dudeOrange.png"))
        bodyOBJ5 = obj_reader.readOBJ2(f'{obj}',os.path.join("objects","textures","dudeGreen.png"))
        self.GPU1 = es.toGPUShape(bodyOBJ1, GL_REPEAT, GL_NEAREST)
        self.GPU2 = es.toGPUShape(bodyOBJ2, GL_REPEAT, GL_NEAREST)
        self.GPU3 = es.toGPUShape(bodyOBJ3, GL_REPEAT, GL_NEAREST)
        self.GPU4 = es.toGPUShape(bodyOBJ4, GL_REPEAT, GL_NEAREST)
        self.GPU5 = es.toGPUShape(bodyOBJ5, GL_REPEAT, GL_NEAREST)
        self.positions = deque([])
        self.initial_size = 5
        self.length = 5
        for i in range(self.initial_size-1):
            self.snake_parts.append(Body())

        for i in range(1,self.initial_size):
            self.snake_parts[i].x += -0.3*i
            for j in np.arange(self.snake_parts[i-1].x,self.snake_parts[i].x,-0.1):
                self.positions.appendleft((j,0,0))
            self.snake_parts[i].move()
Exemplo n.º 3
0
 def __init__(self):
     self.GPUfloor1 = es.toGPUShape(
         bs.createTextureNormalsCube(os.path.join("img", "rainbow1.png")),
         GL_REPEAT, GL_NEAREST)
     self.GPUfloor2 = es.toGPUShape(
         bs.createTextureNormalsCube(os.path.join("img", "rainbow2.png")),
         GL_REPEAT, GL_NEAREST)
     self.GPUfloor3 = es.toGPUShape(
         bs.createTextureNormalsCube(os.path.join("img", "rainbow3.png")),
         GL_REPEAT, GL_NEAREST)
     self.GPUfloor4 = es.toGPUShape(
         bs.createTextureNormalsCube(os.path.join("img", "rainbow4.png")),
         GL_REPEAT, GL_NEAREST)
     self.GPUfloor5 = es.toGPUShape(
         bs.createTextureNormalsCube(os.path.join("img", "rainbow5.png")),
         GL_REPEAT, GL_NEAREST)
     self.transform = tr.matmul([
         tr.translate(0, 0, -5),
         tr.scale(20, 20, 0.001),
         tr.uniformScale(1)
     ])
     self.r, self.g, self.b = np.random.random_sample(
     ), np.random.random_sample(), np.random.random_sample()
     self.weirdTimer = 0
     self.timer = 0
     self.floorPicker = 0
Exemplo n.º 4
0
 def __init__(self):
     while True:
         self.x, self.y = np.random.uniform(-50.0, 50.0, 2)
         if not (self.x**2+self.y**2 < 10): break
     self.s = 3
     self.z = self.s
     self.GPU = es.toGPUShape(oh.readOBJ2(os.path.join('mod','tex','obstacle.obj'), os.path.join('mod','tex','obstacle.png')), GL_REPEAT, GL_NEAREST)
     self.transform = np.matmul(tr.translate(self.x,self.y,self.z), np.matmul(tr.rotationX(np.pi), tr.uniformScale(self.s)))
Exemplo n.º 5
0
 def __init__(self):
     self.GPU = es.toGPUShape(
         oh.readOBJ2(os.path.join('mod', 'tex', 'ground.obj'),
                     os.path.join('mod', 'tex', 'ground.png')), GL_REPEAT,
         GL_NEAREST)
     self.s = 100
     self.x, self.y, self.z = 0, 0, -self.s
     self.transform = np.matmul(tr.translate(self.x, self.y, self.z),
                                tr.uniformScale(self.s))
Exemplo n.º 6
0
    def __init__(self):

        gpu_stem = es.toGPUShape(
            bs.createColorQuad(159 / 255, 107 / 255, 61 / 255))
        gpu_skin = es.toGPUShape(bs.create_circle(0.5, (0, 0),
                                                  (1.0, 0.0, 0.0)))
        gpu_leaf = es.toGPUShape(bs.createColorQuad(0.0, 1.0, 0.0))

        stem = sg.SceneGraphNode("stem")
        stem.transform = tr.matmul(
            [tr.uniformScale(0.5),
             tr.scale(0.5, 1, 1),
             tr.translate(0, 1, 0)])
        stem.childs += [gpu_stem]

        skin = sg.SceneGraphNode("skin")
        skin.transform = tr.matmul([tr.scale(1, 1, 1), tr.translate(0, 0, 0)])
        skin.childs += [gpu_skin]

        leaf = sg.SceneGraphNode("leaf")
        leaf.transform = tr.matmul([
            tr.uniformScale(0.5),
            tr.scale(1, 0.5, 1),
            tr.translate(0.25, 3, 0)
        ])
        leaf.childs += [gpu_leaf]

        apple = sg.SceneGraphNode("apple")
        apple.transform = tr.matmul([
            tr.uniformScale(0.75),
            tr.scale(1 / d["n"], 1 / d["n"], 1),
            tr.scale(1, d["w"] / d["h"], 1)
        ])
        apple.childs += [stem, skin, leaf]

        self.x, self.y = randint(0, d["n"] - 2, 2)
        apple_tr = sg.SceneGraphNode('apple_tr')
        apple_tr.transform = tr.translate(self.x, self.y, 0)
        apple_tr.childs += [apple]

        self.model = apple_tr
Exemplo n.º 7
0
 def __init__(self):
     self.x, self.y, self.z = -99, 0, 1  # position coordinates
     self.rho, self.phi = 0.01, 0  # direction vector
     self.bend = np.pi / 180 * 2 * 2 * 2  # how much to bend when turning
     self.turn = 0  # -1:right, 0:straight, 1:left
     self.time = 0
     self.s = 2  # scale
     self.GPU = es.toGPUShape(
         oh.readOBJ2(os.path.join('mod', 'tex', 'pokeball.obj'),
                     os.path.join('mod', 'tex', 'pokeball.png')), GL_REPEAT,
         GL_NEAREST)
     self.transform = np.matmul(
         np.matmul(tr.translate(*self.pos), tr.uniformScale(self.s / 2)),
         tr.rotationZ(self.phi))
Exemplo n.º 8
0
 def __init__(self):
     self.c = 0
     self.d = 0
     self.go = True
     self.do = True
     self.GPUmenu = es.toGPUShape(
         obj_reader.readOBJ2(
             os.path.join("objects", "snok.obj"),
             os.path.join("objects", "textures", "text.png")), GL_REPEAT,
         GL_NEAREST)
     self.GPUuntitled = es.toGPUShape(
         obj_reader.readOBJ(os.path.join("objects", "untitled.obj"),
                            (1.0, 1.0, 1.0)), GL_REPEAT, GL_NEAREST)
     self.GPUover = es.toGPUShape(
         obj_reader.readOBJ2(
             os.path.join("objects", "gameover.obj"),
             os.path.join("objects", "textures", "text.png")), GL_REPEAT,
         GL_NEAREST)
     self.menuTransform = tr.matmul([
         tr.translate(0.0, 0.0, 8.0),
         tr.uniformScale(2),
         tr.rotationX(np.pi / 2),
         tr.rotationY(3 * np.pi / 2)
     ])
     self.untitledTransform = tr.matmul([
         tr.translate(-2.0, 0.0, 8.0),
         tr.uniformScale(1.5),
         tr.rotationX(np.pi / 2),
         tr.rotationY(3 * np.pi / 2)
     ])
     self.overTransform = tr.matmul([
         tr.translate(0.0, 0.0, 8.0),
         tr.uniformScale(2),
         tr.rotationX(np.pi / 2),
         tr.rotationY(3 * np.pi / 2)
     ])
Exemplo n.º 9
0
 def __init__(self):
     self.x, self.y, self.z = 0.0, 0.0, -4.5
     self.exists = False
     self.theta = 0.0
     self.rare = 1
     self.bans = [(None, None, None)]
     self.GPU = es.toGPUShape(
         obj_reader.readOBJ(os.path.join("objects", "record.obj"),
                            (1.0, 1.0, 1.0)), GL_REPEAT, GL_NEAREST)
     self.transform = tr.matmul([
         tr.translate(0.0, 0.0, self.z),
         tr.uniformScale(1),
         tr.rotationZ(self.theta),
         tr.rotationX(np.pi / 4)
     ])
Exemplo n.º 10
0
    def __init__(self):

        path = os.path.join("model", "gameover.png")
        gpu_gameover = es.toGPUShape(bs.createTextureQuad(path), GL_REPEAT,
                                     GL_NEAREST)

        gameover = sg.SceneGraphNode("gameover")
        gameover.transform = tr.scale(1, d["w"] / d["h"], 1)
        gameover.childs = [gpu_gameover]

        gameover_r = sg.SceneGraphNode("gameover_r")
        gameover_r.childs += [gameover]

        self.model = gameover_r
        self.phi = 0
        self.tick = 0
Exemplo n.º 11
0
    def __init__(self, path):

        gpu_part = es.toGPUShape(bs.createTextureQuad(path), GL_REPEAT,
                                 GL_NEAREST)

        part = sg.SceneGraphNode("part")
        part.transform = tr.matmul([
            tr.scale(1, d["w"] / d["h"], 1),
            tr.scale(1 / d["n"], 1 / d["n"], 1)
        ])
        part.childs += [gpu_part]

        part_tr = sg.SceneGraphNode("part_tr")
        part_tr.transform = tr.identity()
        part_tr.childs += [part]

        self.model = part_tr
Exemplo n.º 12
0
 def __init__(self):
     self.GPU = es.toGPUShape(
         oh.readOBJ(os.path.join('mod', 'tex', 'pikachu.obj'),
                    (250 / 255, 214 / 255, 29 / 255)), GL_REPEAT,
         GL_NEAREST)
Exemplo n.º 13
0
 def __init__(self):
     self.GPU = es.toGPUShape(
         oh.readOBJ(os.path.join('mod', 'tex', 'bulbasaur.obj'),
                    (137 / 255, 200 / 255, 147 / 255)), GL_REPEAT,
         GL_NEAREST)
Exemplo n.º 14
0
 def __init__(self):
     self.GPU = es.toGPUShape(
         oh.readOBJ(os.path.join('mod', 'tex', 'charmander.obj'),
                    (241 / 255, 95 / 266, 62 / 255)), GL_REPEAT, GL_NEAREST)
Exemplo n.º 15
0
 def __init__(self):
     self.GPU = es.toGPUShape(
         oh.readOBJ(os.path.join('mod', 'tex', 'squirtle.obj'),
                    (162 / 255, 215 / 255, 213 / 255)), GL_REPEAT,
         GL_NEAREST)
Exemplo n.º 16
0
    # Connecting the callback function 'on_key' to handle keyboard events
    glfw.set_key_callback(window, on_key)

    # Creating shader programs for textures and for colores
    phongPipeline = es.SimplePhongShaderProgram()
    colorShaderProgram = es.SimpleModelViewProjectionShaderProgram()

    # Setting up the clear screen color
    glClearColor(0.15, 0.15, 0.15, 1.0)

    # As we work in 3D, we need to check which part is in front,
    # and which one is at the back
    glEnable(GL_DEPTH_TEST)

    # Create models
    gpuAxis = es.toGPUShape(bs.createAxis(1))
    obj_axis = bs_ext.AdvancedGPUShape(gpuAxis, shader=colorShaderProgram)

    # Create the grid of the system
    vertex_grid = []
    nx = 40
    ny = 40
    zlim = [0, 0]

    for i in range(nx):  # x
        for j in range(ny):  # y
            xp = -1 + 2 / (nx - 1) * j
            yp = -1 + 2 / (ny - 1) * i
            zp = f(xp, yp, 4)  # Function number 4
            zlim = [min(zp, zlim[0]), max(zp, zlim[1])]
            vertex_grid.append([xp, yp, zp])
Exemplo n.º 17
0
    # Connecting the callback function 'on_key' to handle keyboard events
    glfw.set_key_callback(window, on_key)

    # Creating shader programs for textures and for colores
    textureShaderProgram = es.SimpleTextureModelViewProjectionShaderProgram()
    colorShaderProgram = es.SimpleModelViewProjectionShaderProgram()

    # Setting up the clear screen color
    glClearColor(0.15, 0.15, 0.15, 1.0)

    # As we work in 3D, we need to check which part is in front,
    # and which one is at the back
    glEnable(GL_DEPTH_TEST)

    # Create models
    gpuAxis = es.toGPUShape(bs.createAxis(1))
    obj_axis = bs_ext.AdvancedGPUShape(gpuAxis, shader=colorShaderProgram)

    # Create one side of the wall
    vertices = [[1, 0], [0.9, 0.4], [0.5, 0.5], [0, 0.5]]
    curve = catrom.getSplineFixed(vertices, 10)

    obj_planeL = bs_ext.createColorPlaneFromCurve(curve,
                                                  False,
                                                  0.6,
                                                  0.6,
                                                  0.6,
                                                  center=(0, 0))
    obj_planeL.uniformScale(1.1)
    obj_planeL.rotationX(np.pi / 2)
    obj_planeL.rotationZ(-np.pi / 2)
Exemplo n.º 18
0
def vista():

    # Initialize glfw
    if not glfw.init(): sys.exit()

    WIDTH = 1000
    HEIGHT = 800

    window = glfw.create_window(WIDTH, HEIGHT, "DISCO SNOK! 3D", None, None)

    if not window:
        glfw.terminate()
        sys.exit()

    glfw.make_context_current(window)

    ctrl = Controller()
    glfw.set_key_callback(window, ctrl.on_key)

    # Assembling the shader program (pipeline) with all shaders
    pipeline = es.SimpleModelViewProjectionShaderProgram()  # SIMPLE PIPELINE
    texture_pipeline = es.SimpleTextureModelViewProjectionShaderProgram(
    )  # TEXTURE PIPELINE
    lighting_pipeline = ls.SimpleTexturePhongShaderProgram(
    )  # LIGHTING PIPELINE
    phong_pipeline = ls.SimplePhongShaderProgram()  # PHONG PIPELINE

    # Telling OpenGL to use our shader program
    glUseProgram(pipeline.shaderProgram)

    # Setting up the clear screen color
    glClearColor(0.0, 0.0, 0.0, 1.0)

    # As we work in 3D, we need to check which part is in front,
    # and which one is at the back
    glEnable(GL_DEPTH_TEST)
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)

    # Using the same view and projection matrices in the whole application
    projection = tr.perspective(45, float(WIDTH) / float(HEIGHT), 0.1, 100)

    # MODELOS
    floor = Floor()
    vinyl = Vinyl()
    snake = Snake()
    ctrl.snake = snake.snake_parts[0]
    snake.objective = vinyl
    snake.floor = floor
    vinyl.bans = snake.positions
    screens = Screens()
    camera = Camera()
    camera.snakeView = snake.snake_parts[0]
    ctrl.camera = camera

    wall = bs.createTextureCube(os.path.join("img", "clouds.png"))
    GPUwall = es.toGPUShape(wall, GL_REPEAT, GL_NEAREST)
    wallTransform = tr.matmul(
        [tr.translate(0, 0, 0),
         tr.uniformScale(50),
         tr.uniformScale(1)])
    building = bs.createTextureCube(os.path.join("img", "building.png"))
    GPUbuilding = es.toGPUShape(building, GL_REPEAT, GL_NEAREST)
    buildingTransform = tr.matmul(
        [tr.translate(0, 0, -10.01),
         tr.scale(20, 20, 10),
         tr.uniformScale(1)])
    bottom = bs.createColorCube(0.0, 0.0, 0.0)
    GPUbottom = es.toGPUShape(bottom, GL_REPEAT, GL_NEAREST)
    bottomTransform = tr.matmul(
        [tr.translate(0, 0, -22),
         tr.scale(49.9, 49.9, 1),
         tr.uniformScale(1)])

    limitFPS = 1.0 / 30.0

    lastTime = 0
    timer = 0

    deltaTime = 0
    nowTime = 0

    frames = 0
    updates = 0

    playsound(os.path.join("sound", "Conga_2.mp3"), block=False)

    while not glfw.window_should_close(window):
        # Using GLFW to check for input events
        glfw.poll_events()

        # Clearing the screen in both, color and depth
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        # Main Menu
        if not ctrl.gameStart:
            view = tr.lookAt(
                np.array([0, 0, 20]),  # eye
                np.array([0.0001, 0, 0]),  # at
                np.array([0, 0, 1])  # up
            )

            glUseProgram(texture_pipeline.shaderProgram)
            wallTransform0 = tr.matmul([
                tr.translate(0, 0, 0),
                tr.scale(22, 22, 0.001),
                tr.uniformScale(1),
                tr.rotationZ(3 * np.pi / 2)
            ])
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram, "model"),
                1, GL_TRUE, wallTransform0)
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram,
                                     "projection"), 1, GL_TRUE, projection)
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram, "view"),
                1, GL_TRUE, view)
            texture_pipeline.drawShape(GPUwall)

            screens.mainMenu(lighting_pipeline, projection, view,
                             phong_pipeline)
            glfw.swap_buffers(window)
            continue
        elif ctrl.gameStart and lastTime == 0:
            lastTime = glfw.get_time()
            timer = lastTime

        # GAME OVER
        if not snake.alive:
            view = tr.lookAt(
                np.array([0, 0, 20]),  # eye
                np.array([0.0001, 0, 0]),  # at
                np.array([0, 0, 1])  # up
            )

            glUseProgram(texture_pipeline.shaderProgram)
            wallTransform0 = tr.matmul([
                tr.translate(0, 0, 0),
                tr.scale(22, 22, 0.001),
                tr.uniformScale(1),
                tr.rotationZ(3 * np.pi / 2)
            ])
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram, "model"),
                1, GL_TRUE, wallTransform0)
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram,
                                     "projection"), 1, GL_TRUE, projection)
            glUniformMatrix4fv(
                glGetUniformLocation(texture_pipeline.shaderProgram, "view"),
                1, GL_TRUE, view)
            texture_pipeline.drawShape(GPUwall)

            screens.gameOver(lighting_pipeline, projection, view)
            glfw.swap_buffers(window)
            continue

        # Calculamos el dt
        nowTime = glfw.get_time()
        deltaTime += (nowTime - lastTime) / limitFPS
        lastTime = nowTime

        if not vinyl.exists:
            vinyl.spawn()

        while deltaTime >= 1.0:
            vinyl.update()
            snake.move()
            floor.timer += 1
            if floor.timer % 20 == 0:
                floor.floorPicker += 1
            if floor.weirdTimer > 0:
                if floor.weirdTimer % 10 == 0:
                    floor.update()
                    snake.weirdLight = (floor.r, floor.g, floor.b)
                    snake.lightChange()
                floor.weirdTimer -= 1
                if floor.weirdTimer == 0:
                    snake.weirdLight = (1.0, 1.0, 1.0)
                    snake.lightChange()
            updates += 1
            deltaTime -= 1.0

        view = camera.view()

        if timer > 2.0:
            snake.collisions()

        glUseProgram(texture_pipeline.shaderProgram)

        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "model"), 1,
            GL_TRUE, wallTransform)
        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "projection"),
            1, GL_TRUE, projection)
        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "view"), 1,
            GL_TRUE, view)
        texture_pipeline.drawShape(GPUwall)

        glUseProgram(texture_pipeline.shaderProgram)

        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "model"), 1,
            GL_TRUE, buildingTransform)
        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "projection"),
            1, GL_TRUE, projection)
        glUniformMatrix4fv(
            glGetUniformLocation(texture_pipeline.shaderProgram, "view"), 1,
            GL_TRUE, view)
        texture_pipeline.drawShape(GPUbuilding)

        glUseProgram(pipeline.shaderProgram)

        glUniformMatrix4fv(
            glGetUniformLocation(pipeline.shaderProgram, "model"), 1, GL_TRUE,
            bottomTransform)
        glUniformMatrix4fv(
            glGetUniformLocation(pipeline.shaderProgram, "projection"), 1,
            GL_TRUE, projection)
        glUniformMatrix4fv(
            glGetUniformLocation(pipeline.shaderProgram, "view"), 1, GL_TRUE,
            view)
        pipeline.drawShape(GPUbottom)

        glUseProgram(lighting_pipeline.shaderProgram)
        floor.draw(lighting_pipeline, projection, view)
        snake.draw(lighting_pipeline, projection, view)
        vinyl.draw(phong_pipeline, projection, view)

        frames += 1

        # Once the render is done, buffers are swapped, showing only the complete scene.
        glfw.swap_buffers(window)

        if glfw.get_time() - timer > 1.0:
            timer += 1
            # print("FPS: ",frames," Updates: ",updates)
            updates = 0
            frames = 0

    glfw.terminate()
Exemplo n.º 19
0
    # Connecting the callback function 'on_key' to handle keyboard events
    glfw.set_key_callback(window, on_key)

    # Creating shader programs for textures and for colores
    colorShaderProgram = es.SimpleModelViewProjectionShaderProgram()
    phongPipeline = es.SimplePhongShaderProgram()

    # Setting up the clear screen color
    glClearColor(0.15, 0.15, 0.15, 1.0)

    # As we work in 3D, we need to check which part is in front,
    # and which one is at the back
    glEnable(GL_DEPTH_TEST)

    # Create models
    gpuAxis = es.toGPUShape(bs.createAxis(1))
    obj_axis = bs_ext.AdvancedGPUShape(gpuAxis, shader=colorShaderProgram)

    # Create cilynder, the objective is create many cuads from the bottom, top and
    # mantle. The cilynder is parametrized using an angle theta, a radius r and
    # the height
    h = 1
    r = 0.25

    # Latitude and longitude of the cylinder, latitude subdivides theta, longitude
    # subdivides h
    lat = 20
    lon = 20

    # Angle step
    dang = 2 * np.pi / lat
                if texture else ls.SimpleGouraudShaderProgram())

    # Telling OpenGL to use our shader program
    glUseProgram(pipeline.shaderProgram)

    # Setting up the clear screen color
    glClearColor(0.85, 0.85, 0.85, 1.0)

    # As we work in 3D, we need to check which part is in front,
    # and which one is at the back
    glEnable(GL_DEPTH_TEST)

    try:
        if texture:
            obj_shape = obj_reader.readTextureOBJ(f"{obj}", obj_texture)
            gpuOBJ = es.toGPUShape(obj_shape, GL_REPEAT, GL_LINEAR)

        else:
            gpuOBJ = es.toGPUShape(
                obj_reader.readOBJ(f"{obj}", color=[0.9, 0.6, 0.2]))

    except FileNotFoundError as fe:
        print(f"File not found. Current path is: {os.getcwd()}")
        raise

    # Initializing first variables
    t0 = glfw.get_time()
    at = np.zeros(3)
    z0 = 0.0
    x0 = 0.0
    phi = np.pi * 0.25