Hello guys, I need one help like I am creating viewer based website and there are left side panel and right side panel and between that canvas, like how to set canvas size so model will be properly rendered.
renderer.setSize(canvas.width, canvas.height, false);
with this line of code canvas display very short. I also give height and width, below is the output
display very small in size.
If I use this line of code -
It shows every object in squeeze format.
How to solve this?
setSize in that case may be correct - but you also need to update camera aspect ratio to match the new canvas size (technically speaking, you need to update camera aspect every time canvas is resized.)
Hello I am updating camera aspect ratio also by usiing canvas.width / canvas.heighy but not0 getting the proper results
Did you call
camera.updateProjectionMatrix() after your change on the aspect?
Yes I called that in window resize function
Just define the css properties of height and width in css file, and then get the canvas element from html either by id or class whichever you supplied to the canvas element. Then just use the setsize property of renderer and give canvas.clientwidth and canvas.clientheight as the parameters. Hope this helps you