Bug Issue: Shader and mobile


Pages: 1

RulezTeam

  • Subscriber - Stencyl Studio
  • *
April 18, 2018, 02:15:30 am
Hi,
if I try to use shader on mobile with 9857, the screen become black for all the time that the shader is in use.
This is my shader code :
Code: [Select]
varying vec2 vTexCoord;
uniform sampler2D uImage0;
uniform float uTime;
void main()
{
    float amplitude = 0.02;
    float xTwirl = 5.0;
    float yTwirl = 10.0;
    float speed = 0.0025;

    vec2 texCoord = vTexCoord;
    texCoord.x = texCoord.x + cos(texCoord.y * yTwirl + uTime * speed) * amplitude;
    texCoord.y = texCoord.y + sin(texCoord.x * xTwirl + uTime * speed) * amplitude;
    gl_FragColor = texture2D(uImage0, texCoord);
« Last Edit: April 18, 2018, 06:49:04 am by RulezTeam »


rob1221

  • Master Stencyler
  • *
April 18, 2018, 05:47:23 am
Does the same shader with the same properties work on desktop or HTML5?  Also when you say mobile, did you test both iOS and Android?
  • Status changed from New to Need Info


RulezTeam

  • Subscriber - Stencyl Studio
  • *
April 18, 2018, 06:36:05 am
Hi,
I've tried on HTML5 and I have the same problem: screen goes black until the shader is applied.
And yes, this problem is present on Android and iOS.


rob1221

  • Master Stencyler
  • *
April 18, 2018, 07:17:56 am
This doesn't appear to be a Stencyl bug and is just caused by incorrect shader code.  If you copied the code from someone else then ask the creator about it.

Update: I found the problem.  Add this to the top of your shader code (applies to all shaders)

#ifdef GL_ES
precision mediump float;
#endif
  • Status changed from Need Info to Closed
« Last Edit: April 18, 2018, 07:30:33 am by rob1221 »


RulezTeam

  • Subscriber - Stencyl Studio
  • *
April 18, 2018, 09:25:55 am
Hi rob,

this shader was presented here in Stencyl :

http://www.stencyl.com/help/viewArticle/221
(wave)

Your suggestion isn't working





rob1221

  • Master Stencyler
  • *
April 18, 2018, 09:55:27 am
It's working fine for me on Windows/HTML5/Android.  Make sure your shader code looks like this:

Code: [Select]
#ifdef GL_ES
precision mediump float;
#endif

varying vec2 vTexCoord;
uniform sampler2D uImage0;
uniform float uTime;

void main()
{
    float amplitude = 0.02;
    float xTwirl = 5.0;
    float yTwirl = 10.0;
    float speed = 0.0025;

    vec2 texCoord = vTexCoord;
    texCoord.x = texCoord.x + cos(texCoord.y * yTwirl + uTime * speed) * amplitude;
    texCoord.y = texCoord.y + sin(texCoord.x * xTwirl + uTime * speed) * amplitude;
    gl_FragColor = texture2D(uImage0, texCoord);
}


RulezTeam

  • Subscriber - Stencyl Studio
  • *
April 19, 2018, 02:21:00 am
Hi rob,
I've tried, but doesn't work. I've attached an image of code


New attachment added by RulezTeam - April 19, 2018, 02:21:30 am


rob1221

  • Master Stencyler
  • *
April 19, 2018, 06:40:20 am
I'm still not seeing any issues on my end.  Do you have a sample game?  Maybe there's something else you're doing that's causing the problem.
  • Status changed from Closed to Need Info


RulezTeam

  • Subscriber - Stencyl Studio
  • *
April 20, 2018, 12:41:58 am
Hi rob,
I find the problem. I've clean all project and recompile it and now it's works on html5 and mobile


Issue updated by rob1221 - April 20, 2018, 05:22:11 am
  • Status changed from Need Info to Closed


Pages: 1

Details

  • Reported
    April 18, 2018, 02:15:30 am
  • Updated
    April 20, 2018, 05:22:11 am

  • View Status
    Public
  • Type
    Bug
  • Status
    Closed
  • Priority
    Normal
  • Version
    3.5.0 beta 1
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Engine

Tags


Attachments


* Shader.png (12.49 kB, 884x401 - viewed 20 times.)