问题
I currently have a canvas to which I am rendering a ThreeJS scene. Everything is working fine, however, I would like to display a transparent fill over it.
With a normal canvas, I would simply do
canvas = document.getElementById('canvas');
context = canvas.getContext('2d');
This, of course, doesn't work because I'm using WebGL and the context is different. But I try to apply fillStyle to
renderer.context
Nothing happens. I checked via console and the property does appear in the context as so
WebGLRenderingContext {fillStyle: "rgba(204, 61, 202, 0.7 )", canvas: canvas#canvas, drawingBufferWidth: 475, drawingBufferHeight: 397}
But still, the color doesn't appear.
Any idea if this is even possible?
Link to example http://creativiii.com/
回答1:
I believe you might be looking for
renderer.setClearColor(0xcc3dca, 0.7)
renderer.clear()
来源:https://stackoverflow.com/questions/49993848/webgl-fillstyle