mrdoob/three.js — Issue #892: Color  problems
Author: emin
Created: 2011-12-12 09:42:19+00:00
State: open

Hi,

I 'm working on a project, when i use to set color with setRGB method, that does not work. To make it clear, i have made a test that contains THREE.js and HTML5 Canvas element implementation on same page, both are side by side on the page, respectively. You will easily understand situation.

var color = new THREE.Color( 0x000000 );
color.setRGB( 64 , 191, 64 );

This should be set to green but not work!!

Page:

http://eminkura.com/mandelbrot/colortest.html

The second issue is that i have copied the toHex() method implementation from Three.js, but this method does not convert RGB values to hex value properly or the other Three.js mechanism has bugs. So, that draws the wrong color on the screen. The below page will show you the issue, the left implementation is with three.js and right is with HTML5 Canvas element.

var color = new THREE.Color( toHex(64, 191, 64) ); // not working properly

Page:

http://eminkura.com/mandelbrot/colortest2.html

Thanks,

Emin.