Reputation: 154
I am following an OpenGL tutorial here. It works perfectly on my Arch Linux system, but not on Windows.
My vertex and fragment shader code is exactly like in the example:
Fragment Shader code:
#version 330 core
in vec2 UV;
out vec3 color;
uniform sampler2D myTextureSampler;
void main(){
color = texture2D( myTextureSampler, UV ).rgb;
}
Vertex Shader code:
#version 330 core
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec2 vertexUV;
out vec2 UV;
uniform mat4 MVP;
void main(){
gl_Position = MVP * vec4(vertexPosition_modelspace,1);
UV = vertexUV;
}
I get the following errors on Windows:
ERROR: 0:16: 'texture2D' : no matching overloaded function found (using implicit conversion)
ERROR: 0:16: 'rgb' : field selection requires structure, vector, or matrix on left hand side
ERROR: 0:16: 'assign' : cannot convert from 'const float' to 'FragUserData 3-component vector of float'
Do you have any ideas what the problem might be?
Upvotes: 0
Views: 267
Reputation: 349
This is listed in the v330 spec as @mrVoid mentioned. All of the old texture sampling functions (1D/2D/3D) are now deprecated and instead you should use the overloaded:
This function will change depending on what type of sampler you give it so there is no need to explicitly define which type you are using in the function's name anymore. I to made this mistake on the journey to GL330.
Upvotes: 3