You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You don't need resolution to get the aspect ratio. You can replace the following line... float aspect = resolution.x / resolution.y;
with float aspect = projectionMatrix[1][1] / projectionMatrix[0][0];
Since projectionMatrix[1][1] = f, the field of view, while projectionMatrix[0][0] = f / aspectRatio. https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_model_view_projection
The text was updated successfully, but these errors were encountered:
That's very useful, but it doesn't really remove the need for resolution, since I'm using it in the following line I'm using it to calculate the size of 1px on screen.
Hm, that's a good point. I'm not sure how to remove that.
For better or worse, at least now you just need to pass in resolution.x (one float) instead of vec2 (two floats).
You don't need resolution to get the aspect ratio. You can replace the following line...
float aspect = resolution.x / resolution.y;
with
float aspect = projectionMatrix[1][1] / projectionMatrix[0][0];
Since
projectionMatrix[1][1] = f
, the field of view, whileprojectionMatrix[0][0] = f / aspectRatio
.https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_model_view_projection
The text was updated successfully, but these errors were encountered: