Skip to content

Commit 46ffb09

Browse files
committed
3D examples: Update to new perspective_projection in pyglet
1 parent 330d60d commit 46ffb09

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

arcade/examples/perspective.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self):
5959
)
6060

6161
# # Matrix for perspective projection
62-
self.proj = Mat4.perspective_projection(0, self.width, 0, self.height, 0.1, 100, fov=75)
62+
self.proj = Mat4.perspective_projection(self.aspect_ratio, 0.1, 100, fov=75)
6363
# # Configure the projection in the shader
6464
self.program["projection"] = self.proj
6565

@@ -136,7 +136,7 @@ def draw_offscreen(self):
136136

137137
def on_resize(self, width: float, height: float):
138138
super().on_resize(width, height)
139-
self.program["projection"] = Mat4.perspective_projection(0, self.width, 0, self.height, 0.1, 100, fov=75)
139+
self.program["projection"] = Mat4.perspective_projection(self.aspect_ratio, 0.1, 100, fov=75)
140140

141141

142142
Perspective().run()

arcade/experimental/examples/3d_cube.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def on_update(self, dt):
7373
def on_resize(self, width, height):
7474
"""Set up viewport and projection"""
7575
self.ctx.viewport = 0, 0, width, height
76-
self.program['projection'] = Mat4.perspective_projection(0, self.width, 0, self.height, 0.1, 100, fov=60)
76+
self.program['projection'] = Mat4.perspective_projection(self.aspect_ratio, 0.1, 100, fov=60)
7777

7878

7979
if __name__ == "__main__":

arcade/experimental/examples/3d_cube_with_cubes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def on_update(self, dt):
140140
def on_resize(self, width, height):
141141
"""Set up viewport and projection"""
142142
self.ctx.viewport = 0, 0, width, height
143-
self.program['projection'] = Mat4.perspective_projection(0, self.width, 0, self.height, 0.1, 100, fov=60)
143+
self.program['projection'] = Mat4.perspective_projection(self.aspect_ratio, 0.1, 100, fov=60)
144144

145145

146146
if __name__ == "__main__":

0 commit comments

Comments
 (0)