Shadertoy Glsl-创建一个大矩阵并将其显示在屏幕上
我有64种颜色的调色板。我需要创建一个512*512表,然后将调色板中的颜色索引写入其中,然后在屏幕上显示所有内容。问题是GLSL不支持二维数组,并且不可能在帧之间保存表
I have a palette of 64 colors. I need to create a 512*512 table and write the color indexes in the palette into it, and then display everything on the screen. The problem is that glsl does not support two-dimensional arrays, and it is impossible to save a table between frames
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的最接近的事情是创建一个单独的缓冲区,而仅使用其中的一部分。
这是一个示例缓冲区A:
然后在主着色器中,您可以使用以下像素访问:
如果使用OpenGL而不是Shadertoy,则可以使用纹理2D。
The closest thing you can do is create a separate buffer and only use a part of it.
here's an example buffer A:
then in the main shader, you can can access a pixel with:
If you are using openGL instead of shadertoy, you can use a texture 2d instead.