Note that there are some explanatory texts on larger screens.

plurals
  1. POopengl 3.3+ not compatibily with glsl 130 code?
    primarykey
    data
    text
    <p>I'm having an issue where my glsl 130 code wont run properly on my somewhat modern (ATI 5850) hardware while the identical code runs perfectly fine on an older laptop with a NVIDIA card I have.. This is the case no mater what opengl context I use. What occurs is the vectors: in_position, in_colour and in_normal don't bind properly on the new hardware. It appears I am forced to a newer version of glsl (330) on newer hardware.</p> <p>Here is the glsl code for the vertex shader. Its fairly simple and basic.</p> <pre><code>#version 130 uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix; uniform mat4 normalMatrix; in vec4 in_position; in vec4 in_colour; in vec3 in_normal; out vec4 pass_colour; smooth out vec3 vNormal; void main() { gl_Position = projectionMatrix * viewMatrix * modelMatrix * in_position; vec4 vRes = normalMatrix*vec4(in_normal, 0.0); vNormal = vRes.xyz; pass_colour = in_colour; } </code></pre> <p>What happens is data for:</p> <pre><code>in vec4 in_position; in vec4 in_colour; in vec3 in_normal; </code></pre> <p>doesn't bind or not fully. The values are oddly distorted. From my testing everything else works properly. Changing the version to 330 and using the location keyword fixes the issue, but that also makes the code not compatible with older verions of opengl...</p> <p>Here is a sample of the code I use to specify these locations.</p> <p>for the program:</p> <pre><code>glBindAttribLocation(LD_standard_program, 0, "in_position"); glBindAttribLocation(LD_standard_program, 1, "in_colour"); glBindAttribLocation(LD_standard_program, 2, "in_normal"); </code></pre> <p>and later for the data itself:</p> <pre><code>--- code to buffer vertex data glEnableVertexAttribArray(0); glVertexAttribPointer((GLuint) 0, 4, GL_FLOAT, GL_FALSE, 0, 0); --- code to buffer colour data glEnableVertexAttribArray(1); glVertexAttribPointer((GLuint) 1, 4, GL_FLOAT, GL_FALSE, 0, 0); --- code to buffer normal data glEnableVertexAttribArray(2); glVertexAttribPointer((GLuint) 2, 3, GL_FLOAT, GL_FALSE, 0, 0); </code></pre> <p>My question is: Isn't opengl supposed to be backwards compatible?? I'm starting to be afraid that I'll have to write seperate shaders for ever single version of opengl to make my program run on different hardware... Since binding these attributes is very basic functionality I doubt it's a bug in the ATI implementation...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload