Reputation: 35
I have a question that may sound simply stupid and it's about resolution in THREE.js. I am common with OpenGL and few frameworks around it, so it's pretty obvious that i finally got interested with webGL and therefore Three.js. I tried some simple demos and decided to write something on my own, but here's a problem:
How can i accomplish having canvas with size of 640x480 px, but rendering the 320x240px scene on it's full size?
For example just for performance, or more artistic/oldScholl look?
Thanks in advance.
Upvotes: 1
Views: 2750
Reputation: 71918
You can use CSS. Set the canvas to 320x240px using html attributes or JavaScript, then use CSS to set it to 640x480px. This should scale the canvas and its contents.
For example:
<canvas id="c" width="128" height="128"></canvas>
#c {
width: 256px;
height: 256px;
}
Upvotes: 1