【问题标题】:glsl arithmetic operatorglsl算术运算符
【发布时间】:2022-04-21 21:14:33
【问题描述】:

为什么会出现这一行:

float x = 1 - gl_Color.x;

给:

(26): error: Could not implicitly convert operands to arithmetic operator

【问题讨论】:

    标签: opengl glsl


    【解决方案1】:

    GLSL(#version 120 之前)不允许整数和浮点之间的隐式转换。 1 是一个整数,gl_Color.x 是一个浮点数,所以会出现错误。你需要

    float x = 1.0 - gl_Color.x;
    

    改为

    【讨论】:

      猜你喜欢
      • 2021-12-23
      • 2022-01-07
      • 2012-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-10
      • 2012-03-21
      相关资源
      最近更新 更多