Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

作业1勘误? #4

Open
NoSW opened this issue Nov 9, 2021 · 2 comments
Open

作业1勘误? #4

NoSW opened this issue Nov 9, 2021 · 2 comments

Comments

@NoSW
Copy link

NoSW commented Nov 9, 2021

GAMES101-HW/hw1/main.cpp

Line 51: float top = -tan(DEG2RAD(eye_fov/2.0f) * abs(zNear));
①这里的括号可能是手误? 应该为tan(DEG2RAD(eye_fov/2.0f)) * abs(zNear);

Line 56: 0,0,(zNear+zFar)/(zNear-zFar),(2zNearzFar)/(zFar-zNear),
②4x4矩阵的第三行第四列,漏掉一个负号?refer to http://www.songho.ca/opengl/gl_projectionmatrix.html

@ColourfulBlack
Copy link

ColourfulBlack commented Mar 30, 2022

GAMES101-HW/hw1/main.cpp

Line 51: float top = -tan(DEG2RAD(eye_fov/2.0f) * abs(zNear)); ①这里的括号可能是手误? 应该为tan(DEG2RAD(eye_fov/2.0f)) * abs(zNear);

Line 56: 0,0,(zNear+zFar)/(zNear-zFar),(2_zNear_zFar)/(zFar-zNear), ②4x4矩阵的第三行第四列,漏掉一个负号?refer to http://www.songho.ca/opengl/gl_projectionmatrix.html

@NoSW
第一个问题,感觉确实是写错了;
第二个问题,其实是把负号放到分母上了。

(-zNear * zFar) / (zNear - zFar) = (zNear * zFar) / (zFar - zNear)

@wheelmaker129
Copy link

@NoSW
第一个应该是 float top = -tan(DEG2RAD(eye_fov/2.0f) * zNear;这样的话出来的三角形也是正的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants