hi,
ich wollte gerade meinen Shader erweitern, um mehrere Lichter gleichzeitig zu behandeln. Dazu habe ich die wichtigsten Funktionen in Schleifen verpackt und zwei Arrays hinzugefügt
Zitat: --------------------------- Game --------------------------- Vertex info ----------- (37) : error C5025: lvalue in assignment too complex (38) : error C5025: lvalue in assignment too complex (39) : error C5025: lvalue in assignment too complex (42) : error C5025: lvalue in assignment too complex (43) : error C5025: lvalue in assignment too complex (44) : error C5025: lvalue in assignment too complex
Fragment info ------------- (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>" (8) : error C5041: cannot locate suitable resource to bind parameter "<null atom>"
--------------------------- OK ---------------------------
Das Ganze sieht in Auszügen so aus:
Vertex-Shader:
Code: varying vec3 lightVec[7]; varying vec3 eyeVec[7]; (...) for (int i=0; i <lightcount; i++) { tmpVec = vec3(gl_LightSource[i].position) - vVertex; lightVec[i].x = dot(tmpVec, t); lightVec[i].y = dot(tmpVec, b); lightVec[i].z = dot(tmpVec, n); tmpVec = -vVertex; eyeVec[i].x = dot(tmpVec, t); eyeVec[i].y = dot(tmpVec, b); eyeVec[i].z = dot(tmpVec, n); }
wenn ich das folgendermaßen abändere:
Code: for (int i=0; i <lightcount; i++) { tmpVec = vec3(gl_LightSource[i].position) - vVertex; lightVec[i] = vec3(dot(tmpVec, t), dot(tmpVec, b), dot(tmpVec, n)); tmpVec = -vVertex; eyeVec[i] = vec3(dot(tmpVec, t), dot(tmpVec, b), dot(tmpVec, n)); }
bekomme ich den "too complex" fehler nur zweimal, scheinbar mag er meine Array Zugriffe nicht.
Fragment-Shader:
Code: uniform int lightcount; // Anzahl der genutzten Lichte varying vec3 lightVec[7]; varying vec3 eyeVec[7]; (...) vec4 ColorResult = vec4(0.0, 0.0, 0.0, 0.0); // Farbe des Fragments float distSqr = 0.0; // Quadrat des Abstands von Licht und Vertex (...) for (int i=0; i<lightcount; i++) { distSqr = dot(lightVec[i], lightVec[i]); (...) ColorResult += (vAmbient*base + vDiffuse*base + vSpecular) * att; }
mfg
|