View Full Version : compile error on compiling simple Graphics

05-04-2014, 01:32 PM
hey guys,

I'm kinda new to OpenGL, I used to program in DirectX but now I take a course at my university about computer graphics with OpenGL.
I'm trying to draw an arrow using Trianglestrips, but I get some errors
Log starts like this:

compiling shader <aufgabe2.vs.glsl>
compiling shader <aufgabe2.fs.glsl>
0<5> : error c7548: 'layout<location>' requires "#extension GL_ARB_explicit_uniform_location : enable" before use
0<5> : error C0000: ... or #version 430
followed of an infinite loop of

OpenGL: GL_INVALID_OPERATION error generated. No active program. [source=API type=ERROR severity=HIGH id=1282]

I couldn't find any solution yet.
The Code works on the IDE of a friend of mine, so I think that's the source of the errors.
I'm using Visual Studio C++ 2010 Express.

Thanks for any help =)

Agent D
05-04-2014, 03:44 PM
Could you post some shader source code? The info log error message indicates wrong usage of the layout qualifier (minimum verions 330), what OpenGL(R) version are you using?

05-04-2014, 04:13 PM
Here are my shaders:
Fragment Shader

#version 150 core
#extension GL_ARB_explicit_attrib_location: enable

layout (location = 0) uniform vec4 inputColor;
// output to the (default) FBO in color buffer 0
layout (location = 0) out vec4 outColor;

void main() {
outColor = inputColor;

Vertex Shader

#version 150 core
#extension GL_ARB_explicit_attrib_location: enable

// per-vertex attribute
layout (location = 0) in vec3 position;

//interpolation of output color
//out vec3 vertexColor;

// main entry point for the vertex shader
void main() {
gl_Position = vec4(position.xyz, 1.0);

How do I get to know which version I am using?
thanks for the reply!

Dan Bartlett
05-05-2014, 04:38 AM
Since you're setting a uniform location as well as attrib locations, you will need

#extension GL_ARB_explicit_uniform_location : enable
as well as

#extension GL_ARB_explicit_attrib_location : enable

05-05-2014, 06:39 AM
Now it works =)