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

Resizeable window/canvas #17

Open
LostMoho opened this issue Apr 13, 2022 · 1 comment
Open

Resizeable window/canvas #17

LostMoho opened this issue Apr 13, 2022 · 1 comment

Comments

@LostMoho
Copy link

Sorry for creating an issue to ask a question, but I'm playing around with Marching.js and I find that if I resize the browser window, that rendering gets all messed up. Similarly, if I set up a canvas that is not the shape of the window, say 1000px x 200px, then the rendering has an incorrect aspect ratio.

I suspect that the rendering is based on the initial size of the window. Is there some way to tell marching that the window or canvas has been resized? And is there another place people discuss Marching.js that would be more appropriate for questions?

@LostMoho
Copy link
Author

Oh yeah, it's definitely what I thought. In the Scene object's resolution and render methods, the code is using window.innerWidth instead of this.canvas.clientWidth. This suggests that Marching.js is intended to always use a full-window canvas. I was able to get it to work in a canvas that was not full-window by changing these lines. But it still doesn't resize properly when the canvas resizes - the aspect ratio doesn't adapt to the new canvas size, the rendered image appears stretched. So I guess I'm still trying to figure out how resizing is supposed to be handled.

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