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

Fix rounding issues in viewport rendering #79

Closed
mikolalysenko opened this issue Jul 18, 2016 · 4 comments
Closed

Fix rounding issues in viewport rendering #79

mikolalysenko opened this issue Jul 18, 2016 · 4 comments
Labels
Milestone

Comments

@mikolalysenko
Copy link
Collaborator

We should force all examples to use a power-of-2 sized viewport and to implement correct rounding. The current set up using 5x5 viewports is fragile and fails on some computers. The following formula is correct and works whenever the shape of the viewport is 2^n -by- 2^n:

vec4 pixelToClip(vec2 pixel, vec2 shape){
   return vec4(2.0 * (pixel + 0.5) / shape - 1.0, 0, 1)
}
@mikolalysenko mikolalysenko added this to the 1.0.0 milestone Jul 18, 2016
@Erkaman
Copy link
Member

Erkaman commented Jul 19, 2016

Using a power-of-2 sized viewport does not always solve the issue, I found...

@mikolalysenko
Copy link
Collaborator Author

One solution would be to standardize everything on a fixed 8x8 viewport, which seemed to work ok on all systems tested.

@Erkaman
Copy link
Member

Erkaman commented Jul 27, 2016

Wait, did it really work on all systems? I don't remember...

@mikolalysenko
Copy link
Collaborator Author

I'm just going to write a unit test for it. PR incoming...

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

No branches or pull requests

2 participants