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

Screen edge compensation causes misalignment in shader #153

Open
webstrand opened this issue Dec 17, 2021 · 0 comments
Open

Screen edge compensation causes misalignment in shader #153

webstrand opened this issue Dec 17, 2021 · 0 comments

Comments

@webstrand
Copy link

When using a shader to zoom in on the selection area, the selection rectangle is noticeably offset from the cross-hair by 1px.

demo

The issue seems to be caused by the compensation for the edges of the screen, specifically adding glm::vec2(1*(!lx), 1*(!ly)) to the mouse's position:

memory.rectangle->setPoints(startPoint+glm::vec2(1*lx,1*ly), mouse->getMousePos()+glm::vec2(1*(!lx), 1*(!ly)));

If I understand correctly, the compensation is necessary or it would be impossible to select the bottom-most and left-most pixels of the screen? However, I don't believe that there's a way to reverse this compensation to position the cross-hair accurately in the fragment shader (I'm a novice, though).

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

1 participant