2017-02-23 64 views
0

我使用的着色器,其在另一個程序中工作(在相同的環境據我所知),其現在不能編譯某些原因:錯誤C1105:不能調用非功能

// Vertex Shader 
#version 330 core 
layout(location = 0) in vec3 vertexPosition_modelspace; 
layout(location = 1) in vec2 vertexUV; 
out vec2 fragmentUV; 
uniform mat4 ortho_matrix; 
void main() 
{ 
    gl_Position = ortho_matrix * vec4(vertexPosition_modelspace, 1); 
    fragmentUV = vertexUV; 
} 

// Fragment Shader 
#version 330 core 
in vec2 fragmentUV; 
uniform sampler2D texture; 
out vec4 color; 
void main() 
{ 
    color.rgba = texture(texture, fragmentUV).rgba; 
} 

這是一個超級基本着色器現在它開始突然拋出錯誤。

的Windows 8.1 的Nvidia GeForce 1080(這個是新的,也許這就是問題所在?)

這是什麼由Visual Studio爲輸出:

回答

4
uniform sampler2D texture; 
out vec4 color; 
void main() 
{ 
    color.rgba = texture(texture, fragmentUV).rgba; 
} 

我很驚訝這完全在不同的環境中編譯。您已將紋理命名爲用於進行紋理查找的函數。您需要將uniform sampler2D texture;重命名爲其他內容。

+0

現在我想起它很明顯,但我仍然是GLSL的新手。謝謝,我會盡我所能檢查你的答案。 –