如何传递非插值数据OpenGL ES(GLSL) [英] How to pass non interpolated data OpenGL ES (GLSL)

查看:99
本文介绍了如何传递非插值数据OpenGL ES(GLSL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将简单的FLOAT值从顶点传递到片段着色器.如何不进行插值就按原样"传递它?在桌面上,我可以使用平面变化来禁用插值,openGL es中是否有类似的东西,或者唯一的方法是通过纹理?

I'm trying to pass simple FLOAT value from vertex to fragment shader. How can I pass it "as is" without interpolation? On desktop I could use flat varying to disable interpolation, is there something similar in openGL es or the only way is through texture?

推荐答案

GLSL ES当前不支持 flat 关键字,因此唯一的方法是在所有三角形顶点中使用相同的float值.

GLSL ES does currently not support the flat keyword, so the only way is to use the same float value in all the triangle vertices.

这里给出了相同的答案:在opengl ES 2中是有一种方法可以防止变化的内插

The same answer was given here: In opengl es 2, is there a way to prevent interpolation of varyings

这篇关于如何传递非插值数据OpenGL ES(GLSL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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