I'm attempting to adapt this particular example into CoffeeScript. Below is a snippet of my code:
class Example
width: 640
height: 480
constructor: ->
@camera = new THREE.PerspectiveCamera 45, @width/@height, 10000
@camera.position.z = 300
@scene = new THREE.Scene
cube = new THREE.Mesh(new THREE.CubeGeometry(50,50,50), new THREE.MeshBasicMaterial ({color: 0x000000}))
@scene.add cube
@renderer = new THREE.WebGLRenderer { antialias: true }
@renderer.setSize @width, @height
@renderer.setClearColorHex 0xEEEEEE, 1.0
@renderer.clear()
@element = $(@renderer.domElement).appendTo $('div#display')
@renderer.render(@scene, @camera)
However, when viewed in Chrome and Firefox, only a grey background is visible instead of the expected cube. Additionally, in Chrome, the grey background seems to flicker briefly upon loading. What could be causing this issue?
For context, I have encapsulated this code within its own class using instance variables for future expansion.