着色器编译错误
Shader Compiling Error
我正在开发一个在源代码中隐藏着色器的项目。我收到此错误(在运行时):
Error compiling vertex shader:
Full VS shader source:
//precision highp float;
uniform vec2 uEyeToSourceUVScale;
uniform vec2 uEyeToSourceUVOffset;
attribute vec4 aPosition; ///< [-1,+1],[-1,+1] over the entire framebuffer. Lerp factor in Pos.z. Vignette fade factorin Pos.w.
attribute vec2 aTanEyeAnglesR; ///< The tangents of the horizontal and vertical eye angles for the red channel.
attribute vec2 aTanEyeAnglesG; ///< The tangents of the horizontal and vertical eye angles for the green channel.
attribute vec2 aTanEyeAnglesB; ///< The tangents of the horizontal and vertical eye angles for the blue channel.
varying vec4 vPosition;
varying vec2 vTexCoordR;
varying vec2 vTexCoordG;
varying vec2 vTexCoordB;
void main(void)
{
vPosition = aPosition;
vTexCoordR = aTanEyeAnglesR * uEyeToSourceUVScale + uEyeToSourceUVOffset;
vTexCoordG = aTanEyeAnglesG * uEyeToSourceUVScale + uEyeToSourceUVOffset;
vTexCoordB = aTanEyeAnglesB * uEyeToSourceUVScale + uEyeToSourceUVOffset;
vTexCoordR.y = 1.0 - vTexCoordR.y;
vTexCoordG.y = 1.0 - vTexCoordG.y;
vTexCoordB.y = 1.0 - vTexCoordB.y;
gl_Position = vec4(aPosition.xy, 0, 1);
}
Shader compilation failed.
我不知道如何解决这个问题(没有着色器经验);但是,我知道着色器代码类似于C++代码,从这个意义上说,这对我来说看起来非常简单(除非我错过了什么)。
这个着色器代码有明显的问题吗?
缺少#version
指令意味着#version 110
。
gl_Position = vec4(aPosition.xy, 0, 1);
^ ^ int literals
#version 110
不支持自动int
-> float
转换。 请改用float
文字:
gl_Position = vec4(aPosition.xy, 0.0, 1.0);
^^^ ^^^ float literals
相关文章:
- 用MacOS Mojave编译C++:致命错误:mpi.h:没有这样的文件或目录
- std::is_base_of表示ctor编译错误
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 在没有定义返回类型的函数中返回布尔值,并将结果保存在无错误的char编译中-为什么
- Qt5:使用QCommandLineParser类时出现奇怪的编译错误
- Qt Cmake 错误编译"GuiSupportQt not found"
- Opengl 精度转换错误编译错误 E0415
- 库将ARM架构错误编译为架构X64
- RT 音频 Mac 错误 g++ 编译错误
- 错误编译Boost.log
- 错误编译QT创建者 / QT窗口小部件示例
- 错误编译MIPS32
- Visual Studio 2013 中的错误(编译和运行代码)
- 链接错误编译qt项目在visual 2010
- 无法用模板错误编译nsgmls
- 奇怪的错误.编译失败
- 如果有人调用c++中的方法,则强制错误(编译时)
- 来自autoconf测试的错误编译命令
- 时间限制超出错误C++编译
- SFML 2.3 和 CodeBlocks 错误编译