Hello Guest

Dificulty with OpenGL Version in Ubuntu

  • 1 Replies
  • 265 Views
Dificulty with OpenGL Version in Ubuntu
« on: May 01, 2018, 00:06:06 »
I am starting to learn LWJGL now, and the tutorial that I am following suggested to create a file of the background vertices for me to load inside the program.

The problem is that when i run the program, the information passed to OpenGL returns me some errors like 'OpenGL 3.3 not supported'.

I tried to change the version to 130 but the other errors appear.

As i can't find information about how to write correctly this kind of files, I ask if somebody can review this code for me and explain the important details like syntax and dependencies.

I am using Ubuntu 16.04 LTS with OenGL 3.3 Mesa 17.2.8

Here follow the file code:

Code: [Select]
#version 330 core

layout (location = 0) in vec4 position;
layout (location = 1) in vec2 tc;

uniform mat4 pr_matrix;

void main()
{
    gl_Position = pr_matrix * position;
}

Thanks for the attention!

*

Offline KaiHH

  • ***
  • 131
Re: Dificulty with OpenGL Version in Ubuntu
« Reply #1 on: May 01, 2018, 07:40:07 »
Vertex attribute layout qualifiers have been introduced in GLSL 1.50.
So you would at least need to use #version 150 or you could use #version 130 and omit the layout qualifiers in the GLSL vertex shader and query the automatically assigned attribute indices afterwards in Java via glGetAttribLocation(programId, "position") and glGetAttribLocation(programId, "tc").

I am guessing that the above is the "other errors" you are getting. But in general, when you get any errors then ALWAYS paste them verbatim how the driver logs them. Otherwise, people will always best-guessing what you could probably mean by "other errors".