WebGL Fillstyle [英] WebGL Fillstyle
本文介绍了WebGL Fillstyle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前有一个画布,正在向其渲染ThreeJS场景。一切正常,但是,我想在其上显示透明填充。
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');
这当然是行不通的,因为我使用的是WebGL,并且上下文有所不同。但是我尝试将fillStyle应用于
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.
是否知道是否有可能?
链接到示例 http://creativiii.com/
推荐答案
我相信您可能正在寻找
renderer.setClearColor(0xcc3dca, 0.7)
renderer.clear()
这篇关于WebGL Fillstyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文