我遇到了以下的GLSL代码。我已经尝试在我的OpenGL桌面应用程序中编译它,但是编译器说"不支持的构造":
float[]
camx = float[] ( .2351, 1.2351, 1.2351, 1., .2, .41, .545,.545, .5,.084,.145, 3.04,.12, .44,.44,.416, -1.404, .21,.2351, .2351),
camy = float[] (-.094, .35, .28, .38, .04, .11, -.44,-.44,.35,.0614,.418, 1.,-.96, .67,.8,.0, -1., -.06,-.094),
camz = float[] ( .608, .608, .35, .3608, -.03, .48,.032,.032, .47,0.201,.05,.28,.3, 1.445,1.,1.4, 2.019, .508,.608),
lookx = float[] (-.73, -.627, -1., -.3, -1., -.72, -.82,-.82,-.67,-.5,-.07,-.67,-.27, -.35,-.35,-.775, .08, -.727),
looky = float[] (-.364, -.2, -.2, -.2, 0., -.39, -.5, -.5,-.56,-.37,-.96,-.74,-.94, -.35,-.35,-.1, .83,-.364),
lookz = float[] (-.582, -.582, -.5, -.35, -.0, -.58, -.2776,-.2776,-.48,-.79,-.25,.06,-.18, -.87,-.87,.23, .55, -.582),
minsx = float[] (-.3252,-.3252,-.3252,-.3252,-.3252,-.3252,-.3252,-1.1, -1.05,-1.05,-1.21,-1.22,-1.04,-0.737,-.62,-10., -.653, -.653, -.3252),
minsy = float[] (-.7862,-.7862,-.7862,-.7862,-.7862,-.7862,-.7862,-.787, -1.05,-1.05,-.954,-1.17,-.79,-0.73,-.71,-.75, -2., -2., -.7862),
minsz = float[] (-.0948,-.0948,-.0948,-.0948,-.0948,-.0948,-.0948,-.095,-0.0001,-0.0001,-.0001,-.032,-.126,-1.23,-.85,-.787, -.822, -1.073, -.0948),
minsw = float[] ( .69, .69, .69, .69, .69, .678, .678, .678,.7,.73,1.684,1.49,.833, .627,.77,.826, 1.8976, 1.8899, .69),
maxsx = float[] ( .35,.3457,.3457,.3457,.3457, .3457,.3457,.3457, 1.05,1.05,.39,.85,.3457,.73,.72,5., .888, .735, .35),
maxsy = float[] (1.,1.0218,1.0218,1.0218,1.0218,1.0218,1.0218,1.0218,1.05,1.05,.65,.65,1.0218,0.73,.74,1.67, .1665, 1.),
maxsz = float[] (1.22,1.2215,1.2215,1.2215,1.2215,1.2215,1.2215,1.2215, 1.27,1.4,1.27,1.27,1.2215,.73,.74,.775, 1.2676, 1.22),
maxsw = float[] ( .84, .84, .84, .84, .84, .9834,.9834,.9834,.95,.93,2.74,1.23,.9834, .8335,.14,1.172, .7798, .84);
我需要做什么才能让它运行 - 什么是OpenGL版本,什么是GLSL版本?它可能吗?尝试使用#version 130
以及#version 450
。
甚至调用了这个数组声明语法是什么?因为我不知道,我不能谷歌。
答案 0 :(得分:1)
我不知道是否
df = pd.concat([df] * 10**4, ignore_index=True)
%%timeit
mask = (df['random_string'].str.len() >= 0) & (df['end_location'] >= 0)
df.loc[mask, 'substring'] = [t[0][:int(t[1])] for t in df[mask].values.tolist()]
10 loops, best of 3: 26.1 ms per loop
%%timeit
d1 = df.dropna()
rs = d1.random_string.values.tolist()
el = d1.end_location.values.astype(int).tolist()
df.loc[d1.index, 'substring'] = [s[:int(n)] for s, n in zip(rs, el)]
10 loops, best of 3: 21.5 ms per loop
在WebGL上是合法的,但是:
float[] var = float[](1.0, 2.0, 3.0);
在WebGL,OpenGL ES和桌面OpenGL着色器语言中是合法的。
答案 1 :(得分:1)
使用WEBGL_debug_shaders
扩展名,我们可以看到WebGL正在将着色器转换为。
在我的macOS 10.12.4 MacbookPro上使用NVIDIA GeForce GT 750M它被翻译成
#version 410
vec4 webgl_7ee689ba03587a69;
float webgl_c2b306c049a15ae4[20] = float[20](0.2351, 1.2351, 1.2351, 1.0, 0.2, 0.41, 0.54500002, 0.54500002, 0.5, 0.083999999, 0.145, 3.04, 0.12, 0.44, 0.44, 0.41600001, -1.404, 0.20999999, 0.2351, 0.2351),
webgl_868616b3691095da[19] = float[19](-0.093999997, 0.34999999, 0.28, 0.38, 0.039999999, 0.11, -0.44, -0.44, 0.34999999, 0.0614, 0.41800001, 1.0, -0.95999998, 0.67000002, 0.80000001, 0.0, -1.0, -0.059999999, -0.093999997),
webgl_3e2c7528d4f43c53[19] = float[19](0.60799998, 0.60799998, 0.34999999, 0.3608, -0.029999999, 0.47999999, 0.032000002, 0.032000002, 0.47, 0.20100001, 0.050000001, 0.28, 0.30000001, 1.4450001, 1.0, 1.4, 2.0190001, 0.50800002, 0.60799998),
webgl_9e68babaf2d04cd6[18] = float[18](-0.73000002, -0.62699997, -1.0, -0.30000001, -1.0, -0.72000003, -0.81999999, -0.81999999, -0.67000002, -0.5, -0.07, -0.67000002, -0.27000001, -0.34999999, -0.34999999, -0.77499998, 0.079999998, -0.727),
webgl_4df744ca60a7d008[18] = float[18](-0.36399999, -0.2, -0.2, -0.2, 0.0, -0.38999999, -0.5, -0.5, -0.56, -0.37, -0.95999998, -0.74000001, -0.94, -0.34999999, -0.34999999, -0.1, 0.82999998, -0.36399999),
webgl_a51f276969e67935[18] = float[18](-0.58200002, -0.58200002, -0.5, -0.34999999, -0.0, -0.57999998, -0.27759999, -0.27759999, -0.47999999, -0.79000002, -0.25, 0.059999999, -0.18000001, -0.87, -0.87, 0.23, 0.55000001, -0.58200002),
webgl_bcade59aab63231d[19] = float[19](-0.32519999, -0.32519999, -0.32519999, -0.32519999, -0.32519999, -0.32519999, -0.32519999, -1.1, -1.05, -1.05, -1.21, -1.22, -1.04, -0.73699999, -0.62, -10.0, -0.653, -0.653, -0.32519999),
webgl_f9a51b2fab8f5627[19] = float[19](-0.78619999, -0.78619999, -0.78619999, -0.78619999, -0.78619999, -0.78619999, -0.78619999, -0.787, -1.05, -1.05, -0.954, -1.17, -0.79000002, -0.73000002, -0.70999998, -0.75, -2.0, -2.0, -0.78619999),
webgl_dfe5d0694a0c7e0f[19] = float[19](-0.094800003, -0.094800003, -0.094800003, -0.094800003, -0.094800003, -0.094800003, -0.094800003, -0.094999999, -9.9999997e-05, -9.9999997e-05, -9.9999997e-05, -0.032000002, -0.126, -1.23, -0.85000002, -0.787, -0.82200003, -1.073, -0.094800003),
webgl_6acb30bd922445d0[19] = float[19](0.69, 0.69, 0.69, 0.69, 0.69, 0.67799997, 0.67799997, 0.67799997, 0.69999999, 0.73000002, 1.684, 1.49, 0.833, 0.62699997, 0.76999998, 0.82599998, 1.8976001, 1.8899, 0.69),
webgl_7c494107c1e74a02[19] = float[19](0.34999999, 0.3457, 0.3457, 0.3457, 0.3457, 0.3457, 0.3457, 0.3457, 1.05, 1.05, 0.38999999, 0.85000002, 0.3457, 0.73000002, 0.72000003, 5.0, 0.88800001, 0.73500001, 0.34999999),
webgl_12fa0dbd667de033[18] = float[18](1.0, 1.0218, 1.0218, 1.0218, 1.0218, 1.0218, 1.0218, 1.0218, 1.05, 1.05, 0.64999998, 0.64999998, 1.0218, 0.73000002, 0.74000001, 1.67, 0.1665, 1.0),
webgl_7b478bc2fbbf2bca[18] = float[18](1.22, 1.2215, 1.2215, 1.2215, 1.2215, 1.2215, 1.2215, 1.2215, 1.27, 1.4, 1.27, 1.27, 1.2215, 0.73000002, 0.74000001, 0.77499998, 1.2676001, 1.22),
webgl_3ecd17680ca66be7[18] = float[18](0.83999997, 0.83999997, 0.83999997, 0.83999997, 0.83999997, 0.98339999, 0.98339999, 0.98339999, 0.94999999, 0.93000001, 2.74, 1.23, 0.98339999, 0.83350003, 0.14, 1.1720001, 0.7798, 0.83999997);
void main(){
(webgl_7ee689ba03587a69 = vec4(webgl_c2b306c049a15ae4[3]));
}
const fs = `#version 300 es
precision mediump float;
vec4 outColor;
float[]
camx = float[] ( .2351, 1.2351, 1.2351, 1., .2, .41, .545,.545, .5,.084,.145, 3.04,.12, .44,.44,.416, -1.404, .21,.2351, .2351),
camy = float[] (-.094, .35, .28, .38, .04, .11, -.44,-.44,.35,.0614,.418, 1.,-.96, .67,.8,.0, -1., -.06,-.094),
camz = float[] ( .608, .608, .35, .3608, -.03, .48,.032,.032, .47,0.201,.05,.28,.3, 1.445,1.,1.4, 2.019, .508,.608),
lookx = float[] (-.73, -.627, -1., -.3, -1., -.72, -.82,-.82,-.67,-.5,-.07,-.67,-.27, -.35,-.35,-.775, .08, -.727),
looky = float[] (-.364, -.2, -.2, -.2, 0., -.39, -.5, -.5,-.56,-.37,-.96,-.74,-.94, -.35,-.35,-.1, .83,-.364),
lookz = float[] (-.582, -.582, -.5, -.35, -.0, -.58, -.2776,-.2776,-.48,-.79,-.25,.06,-.18, -.87,-.87,.23, .55, -.582),
minsx = float[] (-.3252,-.3252,-.3252,-.3252,-.3252,-.3252,-.3252,-1.1, -1.05,-1.05,-1.21,-1.22,-1.04,-0.737,-.62,-10., -.653, -.653, -.3252),
minsy = float[] (-.7862,-.7862,-.7862,-.7862,-.7862,-.7862,-.7862,-.787, -1.05,-1.05,-.954,-1.17,-.79,-0.73,-.71,-.75, -2., -2., -.7862),
minsz = float[] (-.0948,-.0948,-.0948,-.0948,-.0948,-.0948,-.0948,-.095,-0.0001,-0.0001,-.0001,-.032,-.126,-1.23,-.85,-.787, -.822, -1.073, -.0948),
minsw = float[] ( .69, .69, .69, .69, .69, .678, .678, .678,.7,.73,1.684,1.49,.833, .627,.77,.826, 1.8976, 1.8899, .69),
maxsx = float[] ( .35,.3457,.3457,.3457,.3457, .3457,.3457,.3457, 1.05,1.05,.39,.85,.3457,.73,.72,5., .888, .735, .35),
maxsy = float[] (1.,1.0218,1.0218,1.0218,1.0218,1.0218,1.0218,1.0218,1.05,1.05,.65,.65,1.0218,0.73,.74,1.67, .1665, 1.),
maxsz = float[] (1.22,1.2215,1.2215,1.2215,1.2215,1.2215,1.2215,1.2215, 1.27,1.4,1.27,1.27,1.2215,.73,.74,.775, 1.2676, 1.22),
maxsw = float[] ( .84, .84, .84, .84, .84, .9834,.9834,.9834,.95,.93,2.74,1.23,.9834, .8335,.14,1.172, .7798, .84);
void main() {
outColor = vec4(camx[3]);
}
`
const gl = document.createElement("canvas").getContext("webgl2");
const ext = gl.getExtension("WEBGL_debug_shaders");
const s = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(s, fs);
gl.compileShader(s);
console.log(ext.getTranslatedShaderSource(s));