Error al compilar el sombreador GLSL en Linux

I recently wrote a basic rendering engine using OpenGL on my Windows machine, everything runs fine on that end. Unfortunately when I attempted to bring it over onto my laptop which is running Ubuntu 12.04 there were some complications, initially the linking settings and libraries were the problem but I managed to sort all that out, my current problem is with compiling the GLSL shaders, when I compile both the vertex and fragment shaders I get the following error.

'0:2(14): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE

This is the code from my vertex shader.

#version 330 core

layout(location = 0) in vec3 position;
layout(location = 1) in vec2 uv;
layout(location = 2) in vec3 normal;

struct DirectionalLight{
    vec3 direction;
    vec3 color;
    vec3 ambient;

uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform DirectionalLight dLight;

out vec2 iUv;
out vec3 iPosition;
out vec3 iNormal;
out vec3 lightDir;

void main()
    iUv = uv;
    iPosition = vec3(viewMatrix * modelMatrix * vec4(position,1));
    iNormal = normal;
    lightDir = vec3(normalize(viewMatrix * vec4(dLight.direction, 0)));

    gl_Position =  projectionMatrix * viewMatrix * modelMatrix * vec4(position,1);

¿Alguna idea?

preguntado el 24 de agosto de 12 a las 09:08

2 Respuestas

  1. Try to add more new blank lines at the end of your shader program.
  2. Try to use a text editor(Ubuntu) to create a new copy of your code.

Respondido 24 Oct 13, 13:10

In my case changing

#version 330 core


#version 330


Respondido 24 Oct 13, 09:10

You are of course aware that the OP might not want to use compatibility profile? - Bartek Banachewicz

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.