Jump to content
  • Advertisement
Sign in to follow this  
BobbyRay

OpenGL Error Compiling Shaders on Mac OS X

This topic is 2641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all,

I'm working on a Stenciling tutorial out of the book "Beginning OpenGL Game Programming". The source code from the book compiles just fine on Mac OS X, but when the shaders are compiled I get an error.

Here are the vertex and fragment shaders, respectively.


#version 120

uniform mat4 projection_matrix;
uniform mat4 modelview_matrix;

in vec3 a_Vertex;
in vec2 a_TexCoord0;
out vec2 texCoord0;

void main(void)
{
vec4 pos = modelview_matrix * vec4(a_Vertex, 1.0);
texCoord0 = a_TexCoord0;
gl_Position = projection_matrix * pos;
}





#version 120


uniform sampler2D texture0;
in vec2 texCoord0;
out vec4 outColor;

void main(void) {
outColor = texture(texture0, texCoord0.st);
}



Here is the error I get when I launch the executable.


Could not compile shader: 2

GLSL Shader: Shader contains errors, please validate this shader!

ERROR: 0:6: Invalid qua

Could not compile the shaders, they are invalid

Could not initialize the shaders




Thanks, I appreciate the help!

Share this post


Link to post
Share on other sites
Advertisement
As far as I know, GLSL 1.2 uses attribute and varying instead of in and out. and the output of the fragment shader is GL_FragColor.

Share this post


Link to post
Share on other sites

Hello all,

I'm working on a Stenciling tutorial out of the book "Beginning OpenGL Game Programming". The source code from the book compiles just fine on Mac OS X, but when the shaders are compiled I get an error.


#version 120


uniform sampler2D texture0;
in vec2 texCoord0;
out vec4 outColor;

void main(void) {
outColor = texture(texture0, texCoord0.st);
}



Here is the error I get when I launch the executable.


Could not compile shader: 2

GLSL Shader: Shader contains errors, please validate this shader!

ERROR: 0:6: Invalid qua

Could not compile the shaders, they are invalid

Could not initialize the shaders




Thanks, I appreciate the help!




Try changing the fragment shader to use the built-in variables and see if it works. Something like this:


#version 120


uniform sampler2D texture0;
in vec2 texCoord0;
//out vec4 outColor;

void main(void) {
gl_FragColor = texture(texture0, texCoord0.st);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!