Skip to content

Commit d71b0d9

Browse files
authored
gl21-cube: fix the aspect ratio
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
1 parent 78e3832 commit d71b0d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gl21-cube/cube.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func setupScene() {
117117

118118
gl.MatrixMode(gl.PROJECTION)
119119
gl.LoadIdentity()
120-
f := ((float64(width) / height) - 1) / 2
120+
f := float64(width)/height - 1
121121
gl.Frustum(-1-f, 1+f, -1, 1, 1.0, 10.0)
122122
gl.MatrixMode(gl.MODELVIEW)
123123
gl.LoadIdentity()

0 commit comments

Comments
 (0)