WebGL片段着色器传递数组 [英] WebGl Fragment Shader pass array

查看:499
本文介绍了WebGL片段着色器传递数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对OpenGL或WebGL知之甚少.我想知道是否可以将片段着色器传递给参数.具体来说,我想将其传递给多维数组,并为每个像素设置颜色,例如:

I know very little about OpenGL or WebGL. I was wondering if it is possible to pass a fragment shader an argument. Specifically, I'd like to pass it a multidimensional array with the colors to set for each pixel, for example:

[0][0][0] = 1

将是(0,0)处像素的红色分量.

would be the red component of the pixel at (0, 0).

推荐答案

做到这一点的标准方法是使用

The standard way of doing this is by using a texture rather than passing an array.

这篇关于WebGL片段着色器传递数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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