Results 1 to 5 of 5

Thread: compile error on compiling simple Graphics

  1. #1
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    3

    compile error on compiling simple Graphics

    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:
    Code :
    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
    Code :
    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 =)
    Neeron

  2. #2
    Senior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    281
    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?

  3. #3
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    3
    Here are my shaders:
    Fragment Shader
    Code :
    #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
    Code :
    #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!

  4. #4
    Senior Member Regular Contributor
    Join Date
    Oct 2009
    Posts
    463
    Since you're setting a uniform location as well as attrib locations, you will need
    Code :
    #extension GL_ARB_explicit_uniform_location : enable
    as well as
    Code :
    #extension GL_ARB_explicit_attrib_location : enable

  5. #5
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    3
    Thanks!
    Now it works =)

Similar Threads

  1. problems in compiling and running a graphics application
    By ArcticPi in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-18-2018, 02:43 PM
  2. errors compiling simple example using OpenGL and QT
    By wambach in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-14-2017, 04:00 AM
  3. Replies: 1
    Last Post: 10-27-2013, 08:57 AM
  4. Shader Compile Error: ERROR: 0:1: '' : syntax error #version
    By Blakeasd in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 07-25-2013, 07:35 PM
  5. Compiling the simple programs
    By ehsan2004 in forum OpenGL ES
    Replies: 6
    Last Post: 12-06-2004, 03:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean