Page 1 of 1

Android random function in fragment shader

Posted: Sat Mar 26, 2016 12:47 pm
by sabadyCZ
Hi,
I really don't know, where can be a problem. I want to create a starfield in the background of the scene, but on some android devices this method doesn't work at all.

Here is a random function in fragment shader:

Code: Select all

float rand(vec2 co){
    return fract(sin(dot(co.xy ,vec2(1.9898,1.233))) * 43758.5453);
}
If I remove fract function, it draw something, otherwise it doesn't draw anything. Is there any other way to make random function or something like that?

On a PC and Samsung galaxy mini 2 it works, there isn't any problem, but LG G2 and Samsung Galaxy S3 not. So that is really strange. I'm using a LOVE for android from google play.