WebGL Fillstyle

孤街浪徒 提交于 2020-02-25 04:07:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!