[英]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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.