gpt4 book ai didi

opengl - GLSL 扩展支持 ? : ternary operator?

转载 作者:行者123 更新时间:2023-12-04 00:36:04 27 4
gpt4 key购买 nike

我正在使用 #version 120 将 WebGL GLSL 着色器移植到 OpenGL GLSL 桌面.

是否有任何扩展可以增加对 ?: 的支持?三元运算符?

像:

#extension GL_EXT_***: enable

最佳答案

不需要扩展,它在基本规范中是正确的:

OpenGL Shading Language 1.20 Specification ,第 5.9 节“表达式”,第 38 页,第 6 个项目符号:

The ternary selection operator (?:). It operates on three expressions (exp1 ? exp2 : exp3). This operator evaluates the first expression, which must result in a scalar Boolean. If the result is true, it selects to evaluate the second expression, otherwise it selects to evaluate the third expression. Only one of the second and third expressions is evaluated. The second and third expressions can be any type, as long their types match, or there is a conversion in Section 4.1.10 “Implicit Conversions” that can be applied to one of the expressions to make their types match. This resulting matching type is the type of the entire expression.

关于opengl - GLSL 扩展支持 ? : ternary operator?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42335033/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com