Skip to content

Commit

Permalink
gl21-cube: fix the aspect ratio
Browse files Browse the repository at this point in the history
Given the 4:3 aspect ratio, f comes out to 0.1(6). When you now define
frustum in the next line, you get an aspect ratio of 2.(3):2 or 7:6, and
the resulting cube is squished. Not much, but enough to feel off.

GitHub-Pull-Request: #78
  • Loading branch information
antichris authored Feb 16, 2022
1 parent 78e3832 commit d71b0d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gl21-cube/cube.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func setupScene() {

gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
f := ((float64(width) / height) - 1) / 2
f := float64(width)/height - 1
gl.Frustum(-1-f, 1+f, -1, 1, 1.0, 10.0)
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
Expand Down

0 comments on commit d71b0d9

Please sign in to comment.