[solved] shader creation problem

hello to everyone,

ps. i just solved it, i had the materials parameters defined inside an “if-statement” that was never entered.

original message:

i have the following problems :

i cannot pass parameters from my program to my shader. note that “…” means original code.

  1. In file Unshaded.j3md:

    MaterialDef Unshaded {

    MaterialParameters {

    // if true it will translate (u,v) coordinates by (TranslateUV.x, TranslateUV.y) per second.

    Boolean TranslateUVCoord

    Vector2 TranslateUV

    // if true it will rotate (u,v) coordinates by RotateUV per second.

    Boolean RotateUvCoord

    Float RotateUV

    //if true it will scale (u,v) coordinates by (ScaleUV.x, ScaleUV.y) per second.

    Boolean ScaleUvCoord

    Vector2 ScaleUV


    Technique {

    VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert

    FragmentShader GLSL100: shaders/Unshaded.frag

    WorldParameters {




    Defines {

    TRANSLATE_UV_COORD : TranslateUVCoord

    ROTATE_UV_COORD : RotateUvCoord

    SCALE_UV_COORD : ScaleUvCoord


  2. In file Unshaded.frag:

    #if defined(TRANSLATE_UV_COORD) || defined(ROTATE_UV_COORD) || defined(SCALE_UV_COORD)

    uniform float g_Time;



    uniform vec2 m_TranslateUV;


    #ifdef ROTATE_UV_COORD

    uniform vec2 m_RotateUV;


    #ifdef SCALE_UV_COORD

    uniform float m_ScaleUV;


    The problem is that TRANSLATE_UV_COORD is not defined even when i do :

    mat.setBoolean(“TranslateUVCoord”, true); from the code.

    Also same problem for m_TranslateUV when i do :

    mat.setVector2(“TranslateUV”, new Vector2f(1f,1f));