   GLSL weirdness bonanza
  ok Im gettin really depressed..Im getting WEIRD behaviour everywhere.. kinda if I change gl_FragColor to be a simple yellow vec4, I get a yellow cube, if I do something like:vec4 r = vec4(1.0,1.0,0.0,1.0);gl_FragColor = r;I get random triangles everywhere..flat varying generate a linking error with an empty info string (but compilation is ok)tought it was a crappy intel driver implementation (under win7), I moved the project to a FreeBSD-Mesa7.8.1 (OGL 2.1) box, compiled wonderfully (no link errors of any kind), but I got something like:varying float a;attribute float b;[...]gl_Position = k;works.. if I add this line before gl_Position:vec4 a = b;I get a linker error. game over.The box had a NVidia Quadro FX330.. (old but cute)just to try, I moved to another FreeBSD box, same Mesa version, but different card (another Intel series 4 express or whatever they call it)now I have eveything working but no lines at all.. nothing.. just triangles..and the same weird things.. like if I add a line like vec4 a = vec4(0.0,0.0,0.0,1.0) (I mean, a totally useless line), maybe I get different results..now.. how am I supposed to develop anything in this nightmare?Is tehre something I didnt get? I mean.. like therere just 2 uniforms and 2 variables.. or anything like that? what the hell is all this? 3 different machines, and different random result everywhere just adding dummy lines of code..I feel really fustrated..what puzzles me more is that both bsd boxes have the same FreeBSD version (7.2) with the same Mesa version (7.8.1), but on the first something just dont compile, while on the second the exact same thing do compile, but maybe doesnt link (for no reason at all I should add) or if it does, I get random results..and btw, who is supposed to compile? Mesa? the video driver? the gpu? why do I get different compilation results of the same code with the same os and the same mesa version?uff..   
  Hah I understand your frustration, but can you show something a little more coherent? Its hard to help without any real code. Can you create a minimal program that shows your "weirdness bonanza" and paste the code here? Its possible that your drivers are just screwed, but it is also possible that its just a series of bad coincidences.Quote:varying float a;attribute float b;[...]gl_Position = k;works.. if I add this line before gl_Position:vec4 a = b;I'm not sure if these 'a' and 'b' are from the same program same as above, but are you trying to assign a float to a vec4? And redeclaring 'a' from float to vec4? Are you certain you're querying the info strings correctly? Maybe post that code too.   ;  aw.. sorry I was so angry I didnt even check the examples.. no I was not trying to 'cast' a float to a vec4 of course..btw, here is the vertex shaderuniform mat4 mvMatrix;uniform mat4 pjMatrix;uniform mat4 nrMatrix;uniform int flags[5];attribute vec4 pri_idc;attribute vec3 pri_vtx;attribute vec3 pri_nrm;varying vec4 out_idc;varying float lgt_int;void main() {    if(flags[LIGHTING] != 0) {   vec4 n = nrMatrix * vec4(pri_nrm,1.0);   vec4 p = mvMatrix * vec4(pri_vtx,1.0);   vec4 l = vec4(10.0,10.0,10.0,1.0);   lgt_int = dot(n,normalize(l - p));    }    if(flags[ID] != 0 && flags[DIRECT_ID] == 0) out_idc = pri_idc;    gl_Position = pjMatrix * mvMatrix * vec4(pri_vtx,1.0);}and heres the fragmentuniform vec4 colore;uniform int flags[5];uniform sampler2D tex_smp;varying vec4 out_idc;varying float lgt_int;void main() {    vec4 r;    if(flags[ID] == 0) {   if(flags[TEX] != 0) r = texture2D(tex_smp,gl_PointCoord);   else r = colore*(flags[LIGHTING] != 0 ? lgt_int : 1.0)+0.2;    }    else r = (flags[DIRECT_ID] != 0 ? colore : colore);    gl_FragColor = r;}I had to use int[] since version 120 doesnt support bitwise operators..on one of the 3 machines, I get a vertex shader compilation error.. on another one (the nvidia) it compiles, but I get a blank screen.. unless I comment out_idc=pri_idc.. if I dovec4 r = pri_idcout_idc = vec4(0,0,0,0);it compiles (but of course doesnt do what i want).. if I dovec4 r = pri_idcout_idc =rI again get a blank screenwhat is the problem in assigning a per-vertex value to a varying in order to pass it to a fragment shader?on the last box everything compiles.. but I dont have ANY line.....   ;  uh.. just a mistake.. the else in the fragment is thiselse r = (flags[DIRECT_ID] != 0 ? colore : out_idc);doenst make much sense in having both options equals in a (?:) operator :)PS: dont pay too much attention to the code.. if I started writing things likeif(a[x] == 0) or != 0 or splitted things into multiple lines, its just because Im trying every absurd thing that crosses my mind in irder to make this thing work (and possibly have it working on at least both bsd boxes)   ;  Well I don't have any idea what that shader is supposed to be doing, but if you're getting a blank screen that could be due to 100 different things and most of them would not be the fault of the glsl compiler. If you just do a really simple shader to shade one triangle a flat color can you get everything to work? Maybe then try adding lighting? Take baby steps, and make sure everything compiles successfully at every step. Check error logs if its not compiling. GLSL is not like a regular program where you can just throw all your code in at once and then fight your way out with the debugger, you have to make slow and deliberate steps and verify that it is working at every stage. I get the impression that you're just thrashing around changing things hoping that you'll stumble over the problem.Also please use the source tags for code, its easier to read.   ;  you got me wrong.. I just trowed all the code to check theres something basically wrong.. anyway.. have a look at this: (suppose col=vec4(1.0,1.0,0.0,1.0) a 'yellow')vertex:void main() {///    vec4 n = nrMatrix * vec4(pri_nrm,1.0);///    vec4 p = mvMatrix * vec4(pri_vtx,1.0);///    vec4 l = vec4(10.0,10.0,10.0,1.0);///    lgt_int = dot(n,normalize(l - p));    lgt_int = 1.0;    gl_Position = pjMatrix * mvMatrix * vec4(pri_vtx,1.0);}fragment:voi main() {    gl_FragColor = col*lgt_int;}this gives me a yellow triangle, just as expectedif I uncomment ANY (even just one of them) of the n,p or l vec4 in the vertex shader (and keep lgt_int = 1.0), I get an empty screen (just background)does this make any sense at all?PS: im looking for the tags :)   ;  heres something..   vec4 n = nrMatrix * vec4(pri_nrm,1.0);   vec4 p = mvMatrix * vec4(pri_vtx,1.0);   vec4 l = vec4(10.0,10.0,10.0,1.0);with this I get a properly lit cubeand..   vec4 l = vec4(10.0,10.0,10.0,1.0);   vec4 n = nrMatrix * vec4(pri_nrm,1.0);   vec4 p = mvMatrix * vec4(pri_vtx,1.0);with this I get a full white cube..I just brought up vec4 l to be set at first.. does this have a meaning for anyone??   ;  another one: in fragment...uniform int flg[5];void main() { gl_FragColor = a*b; }this is ok, a yellow triangle.. if I add a dummy if, like:void main() {    if(flg[0] == 0) {    }    gl_FragColor = a*b;}I get a randomly dotted triangle..again.. what is the problem here for such an illogical behaviour? the compiler? my code? a driver issue?edit: if I change the if to be: if(true) { } then I get a proper yellow triangle again.. seems like things go wrong when I try to access any uniform variable..   ;  I have found that declaring variables which are not used causes undefined (as far as I can see) behaviour.  Perhaps this is due to optimization...   ;  I disabled Mesa compiler optimizations and commented any unused variables.. no luck   