I have encountered a problem with implementation of a custom shader that for some odd reason, causes my app to crash on an iPhone 5 and iPad mini but not an iPhone 6 or iPhone 6 plus! I am getting a segmentation fault 11 error that causes my app to crash immediately after it is opened. Any help is appreciated!
Below is the code for my custom shader and my implementation of it:
–kernel file to make shader
local kernel = {}
kernel.language = “glsl”
kernel.category = “generator”
kernel.name = “wheel”
kernel.isTimeDependent = true
kernel.fragment =
[[
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
{
P_UV vec2 pos = 2. * (texCoord - .5); // Get relative position and normalize it to [-1, 1]
P_UV float len = length(pos);
if (len > .9) return vec4(0.); // “outside”, use clear color
if (len < .8) return vec4(0., 0., 1., 0.); // inner body, blue
P_UV float PI_OVER_TWO = 2. * atan(1.); // arctangent of 1 = pi / 4
P_UV float angle = atan(pos.y, pos.x); // returns value in [-pi / 2, pi / 2]
if (angle < -PI_OVER_TWO) return vec4(1., 0., 0., 1.); // red
I have encountered a problem with implementation of a custom shader that for some odd reason, causes my app to crash on an iPhone 5 and iPad mini but not an iPhone 6 or iPhone 6 plus! I am getting a segmentation fault 11 error that causes my app to crash immediately after it is opened. Any help is appreciated!
Below is the code for my custom shader and my implementation of it:
–kernel file to make shader
local kernel = {}
kernel.language = “glsl”
kernel.category = “generator”
kernel.name = “wheel”
kernel.isTimeDependent = true
kernel.fragment =
[[
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
{
P_UV vec2 pos = 2. * (texCoord - .5); // Get relative position and normalize it to [-1, 1]
P_UV float len = length(pos);
if (len > .9) return vec4(0.); // “outside”, use clear color
if (len < .8) return vec4(0., 0., 1., 0.); // inner body, blue
P_UV float PI_OVER_TWO = 2. * atan(1.); // arctangent of 1 = pi / 4
P_UV float angle = atan(pos.y, pos.x); // returns value in [-pi / 2, pi / 2]
if (angle < -PI_OVER_TWO) return vec4(1., 0., 0., 1.); // red