3D resolution change

I have a question that might sound just plain stupid, and that concerns the resolution in THREE.js. I often see OpenGL and a few frameworks around it, so it’s pretty obvious that I finally got interested in webGL and, therefore, Three.js. I tried some simple demos and decided to write something myself, but here is the problem:

How can I make a canvas with a size of 640x480 pixels, but at the same time on a 320x240px scene on it in full size?

For example, for performance or a more artistic / oldScholl look?

Thanks in advance.

+1
source share
1 answer

You can use CSS. Set the canvas to 320x240px using the html or JavaScript attributes, then use CSS to set it to 640x480px. This should scale the canvas and its contents.

For instance:

<canvas id="c" width="128" height="128"></canvas> 
 #c { width: 256px; height: 256px; } 

http://jsfiddle.net/jwy6a/

+1
source

All Articles