创建 WebGL 上下文后,如何设置它的属性? [英] How do I set the attributes of a WebGL context after it has been created?

查看:27
本文介绍了创建 WebGL 上下文后,如何设置它的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可以在创建上下文时为 WebGL 上下文指定属性:

I know that we can specify attributes for a WebGL context when we create the context:

var ctx = myCanvas.getContext(‘webgl’, attributes);

有没有什么方法可以在ctx创建后调用来设置ctx的属性?例如,我们可以做一些类似于

Is there a method that we can call to set the attributes of ctx after ctx has been created? For instance, can we do something akin to

var ctx = myCanvas.getContext(‘webgl’);
ctx.setAttributes(attributes);

推荐答案

这需要能够更改上下文的属性.你不允许这样做.它们在上下文创建时固定.

That would require being able to change the attributes of a context. Which you're not allowed to do. They're fixed at context creation time.

这篇关于创建 WebGL 上下文后,如何设置它的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆