User Tag List

Results 1 to 7 of 7

Thread: Android Glsl Shader pack#2

  1. #1
    Clicker Fusion 2.5
    Gigatron's Avatar
    Join Date
    Jun 2020
    Location
    France
    Posts
    265
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Android Glsl Shader pack#2

    Hi all

    I am on vacation soon , i've started to code DX9 shaders to Android Shader with C# but not finished.

    sc.jpg

    To learn how convert DX9 shader to Android shader manually, i ve played with 2 shaders.

    Amiga Copperbar and Space harrier floor shader;

    Screenshot_20220923-230523_Runtime Android.jpg

    You can compare DX9 shader(HLSL) with glsl shader and understand how it's done;
    More shader will be released in the future;


    Regards
    Attached files Attached files

  2. #2
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,437
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    That's really really useful, I was actually planning on doing something like this as well.
    What do you use to check for compilation errors and stuff?

  3. #3
    Clicker Fusion 2.5
    Gigatron's Avatar
    Join Date
    Jun 2020
    Location
    France
    Posts
    265
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NaitorStudios View Post
    That's really really useful, I was actually planning on doing something like this as well.
    What do you use to check for compilation errors and stuff?

    The new RuntimeAndroid.zip allow now shader for android.

    Let's see how it's working, it use 2 block of code the first one is vertex and the second fragment part anfd both use block detection with

    //@Begin_vertex <-- important vertex block start
    //@End <-- end block

    Same block with fragment start and end block;

    //@Begin_fragment
    //@End

    @Begin and @End are used by the runtime...

    So let's make a simple red screen android shader;

    Code:
    //@Begin_vertex
    #ifdef GL_ES
     precision mediump float;
    #endif
    uniform mat4 transformMatrix;
    uniform mat4 projectionMatrix;
    
    attribute vec4 position;
    attribute vec2 texCoord;
    
    varying vec2 textureCoordinate;
    
    void main(void)
    {
        textureCoordinate = texCoord;
        gl_Position = projectionMatrix * transformMatrix * position;
    }
    //@End
    
    //@Begin_fragment
    
    #ifdef GL_ES
     precision mediump float;
    #endif
     
    void main(void)
    {
          
          gl_FragColor = vec4(1.0,0.0,0.0,1.0);
           
    }
    //@End
    Never change vertex part; to test your shader if not using texture go to https://glslsandbox.com/

    Use only fragment part to test your shader in glslsandbox;

    You can detect error by using android studio build part log.

    Hope this help you to make android shader;

    Regards

  4. #4
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,437
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Oh thank you
    How to I detect shader errors on Android Studio?

  5. #5
    Clicker Fusion 2.5
    Gigatron's Avatar
    Join Date
    Jun 2020
    Location
    France
    Posts
    265
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NaitorStudios View Post
    Oh thank you
    How to I detect shader errors on Android Studio?
    This is the BEST part of the solution; you must produce an error while building part to obtain all files in temp directory;
    To do this unzip RuntimeAndroid.zip somewhere ; then open a file in extension drawer eg :

    C:\Program Files (x86)\Clickteam Fusion Developer 2.5\Data\Runtime\Android\RuntimeAndroid.zip\app\sr c\main\java\Extensions\CExtLoad.java

    in CExtLoad.java line 25 make an error in this line eg with adding **:

    25 import Runtime.Log**;

    Save the file

    Rezip all file to RuntimeAndroid.zip

    open Fusion and create android project

    Add sprite and set an effect to it ;

    When building the project you have an error occured on CExtLoad.java ; don't close the error window go to the temp file and copy all generated file
    somewhere you want, this generated file is android studio project file;

    unzip again RuntimeAndroid.zip

    goto C:\Program Files (x86)\Clickteam Fusion Developer 2.5\Data\Runtime\Android\RuntimeAndroid.zip\app\sr c\main\java\Extensions\CExtLoad.java

    correct the error in CExtload.java at line 25 remove double stars


    25 import Runtime.Log**;

    to


    25 import Runtime.Log;

    Rezip RuntimeAndroid.zip

    Open android studio and open the project drawer file then you can test the fusion android project with smartphone:

    It's difficult to explain with my english sorry ..

    The best way is asking CT staff to have an option for generating android studio project file;

    Regards

  6. #6
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,437
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I know about this approach but thought there was a simpler way to debug the shaders...
    Sure, it would be helpful if it had an option to export the project just like iOS/Mac runtimes.

  7. #7
    Clicker Fusion 2.5
    Gigatron's Avatar
    Join Date
    Jun 2020
    Location
    France
    Posts
    265
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NaitorStudios View Post
    Yeah, I know about this approach but thought there was a simpler way to debug the shaders...
    Sure, it would be helpful if it had an option to export the project just like iOS/Mac runtimes.
    Sure option to export the project just like iOS/Mac runtimes will be awesome to gain time;


    Debug the shader just use glslsandbox if it's working there it's working for android;


    go to the glslsandbox and click to New Shader



    copy just the main loop part on glslsandbox without //@Begin or //@End don"t use vertex part ...

    for example remove the main loop; and past your shader;


    like so with red screen :

    Code:
    #extension GL_OES_standard_derivatives : enable
    
    precision highp float;
    
    uniform float time;
    uniform vec2 mouse;
    uniform vec2 resolution;
    
    
    // your shader start here ;
    void main( void ) {
     
    
        gl_FragColor = vec4( 1.0,0.0,0.0, 1.0 );
    
    }
    
    // if you want use uniform in android shader like color
    
    #extension GL_OES_standard_derivatives : enable
    
    precision highp float;
    
    uniform float time;
    uniform vec2 mouse;
    uniform vec2 resolution;
    
    
    // your shader start here ;
    
    vec3 color = vec3(0.0,1.0,0.0);
    
    void main( void ) {
    
        gl_FragColor = vec4( color, 1.0 );
    
    }

    if it's working on glslsandbox it's now ok for android ;

    The final shader for android :


    Code:
    
    
    //@Begin_vertex 
    #ifdef GL_ES  precision mediump float; 
    #endif 
    
    uniform  mat4 transformMatrix; 
    uniform mat4 projectionMatrix;
     attribute vec4  position; 
    attribute vec2 texCoord;
      varying vec2 textureCoordinate;
     
     void main(void) {
    
         textureCoordinate = texCoord;     
    gl_Position =  projectionMatrix * transformMatrix * position; 
    } 
    //@End  
     //@Begin_fragment 
     #ifdef GL_ES  
    precision mediump float; 
    #endif  
    
    uniform vec3 color; 
    
    void main(void) {    
    
              gl_FragColor = vec4(color,1.0);  
    
           } 
    
    //@End

Similar Threads

  1. Android shader fx pack#1
    By Gigatron in forum Android Export Module 2.5
    Replies: 24
    Last Post: 14th November 2022, 05:24 AM
  2. Android Exporter Glsl Shader
    By Gigatron in forum Android Export Module 2.5
    Replies: 6
    Last Post: 15th August 2021, 07:13 PM
  3. Shader pack#1 for DX9
    By Gigatron in forum Shader Development
    Replies: 6
    Last Post: 17th August 2020, 12:39 AM
  4. Looki's shader pack
    By Looki in forum Hardware Accelerated Runtime
    Replies: 68
    Last Post: 9th January 2020, 04:36 PM
  5. Looki's Shader Pack 2.0
    By Jeff in forum Shaders
    Replies: 0
    Last Post: 13th March 2009, 02:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •