Opengl es OpenGL ES'<<';不在'上运行;int';和';int';
我有一个与我的Mac应用程序完美配合的着色器。但现在我正试图制作一个iOS版本的应用程序,我得到了一个奇怪的错误。以下是片段着色器的一部分:Opengl es OpenGL ES'<<';不在'上运行;int';和';int';,opengl-es,shader,bitwise-operators,Opengl Es,Shader,Bitwise Operators,我有一个与我的Mac应用程序完美配合的着色器。但现在我正试图制作一个iOS版本的应用程序,我得到了一个奇怪的错误。以下是片段着色器的一部分: uniform sampler2D image; varying lowp vec2 fragTex; int LFSR_Rand_Gen(in int n) { n = (n << 13) ^ n; return (n * (n*n*15731+789221) + 1376312589) & 0x7fffffff; } floa
uniform sampler2D image;
varying lowp vec2 fragTex;
int LFSR_Rand_Gen(in int n)
{
n = (n << 13) ^ n;
return (n * (n*n*15731+789221) + 1376312589) & 0x7fffffff;
}
float LFSR_Rand_Gen_f(in int n )
{
return float(LFSR_Rand_Gen(n));
}
float noise3f(in vec3 p)
{
ivec3 ip = ivec3(floor(p));
vec3 u = fract(p);
u = u*u*(3.0-2.0*u);
int n = ip.x + ip.y*57 + ip.z*113;
float res = mix(mix(mix(LFSR_Rand_Gen_f(n+(0+57*0+113*0)),
LFSR_Rand_Gen_f(n+(1+57*0+113*0)),u.x),
mix(LFSR_Rand_Gen_f(n+(0+57*1+113*0)),
LFSR_Rand_Gen_f(n+(1+57*1+113*0)),u.x),u.y),
mix(mix(LFSR_Rand_Gen_f(n+(0+57*0+113*1)),
LFSR_Rand_Gen_f(n+(1+57*0+113*1)),u.x),
mix(LFSR_Rand_Gen_f(n+(0+57*1+113*1)),
LFSR_Rand_Gen_f(n+(1+57*1+113*1)),u.x),u.y),u.z);
return 1.0 - res*(1.0/1073741824.0);
}
void main()
{
// calculations
gl_FragColor = fragTex;
}
均匀采样二维图像;
可变低电压vec2-fragTex;
整数LFSR\u Rand\u Gen(整数n)
{
n=(n您在哪台设备上进行测试?我在iOS模拟器上进行测试。我尝试了kEAGLRenderingAPIOpenGLES2和kEAGLRenderingAPIOpenGLES3,结果相同。
#version 300 es
#version 300 es
in vec4 position;
in vec3 normal;
out lowp vec4 colorVarying;
uniform mat4 modelViewProjectionMatrix;
uniform mat3 normalMatrix;
void main()
{
int a, b, c;
c = a & b;
// template stuff follows
vec3 eyeNormal = normalize(normalMatrix * normal);
vec3 lightPosition = vec3(0.0, 0.0, 1.0);
vec4 diffuseColor = vec4(0.4, 0.4, 1.0, 1.0);
float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition)));
colorVarying = diffuseColor * nDotVP;
gl_Position = modelViewProjectionMatrix * position;
}
#version 300 es
in lowp vec4 colorVarying;
out lowp vec4 my_FragColor;
void main()
{
my_FragColor = colorVarying;
}
int a, b, c;
c = a & b;