Package com.badlogic.gdx.graphics.glutils

Examples of com.badlogic.gdx.graphics.glutils.ShaderProgram


      + "void main()\n"//
      + "{\n" //
      + "  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" //
      + "}";

    shader = new ShaderProgram(vertexShader, fragmentShader);
    if (shader.isCompiled() == false) throw new IllegalArgumentException("couldn't compile shader: " + shader.getLog());
  }
View Full Code Here


    Gdx.app.log( "ShaderLoader", "Compiling " + log );

    String vpSrc = Gdx.files.internal( BasePath + vertexFileName + ".vertex" ).readString();
    String fpSrc = Gdx.files.internal( BasePath + fragmentFileName + ".fragment" ).readString();

    ShaderProgram program = ShaderLoader.fromString( vpSrc, fpSrc, vertexFileName, fragmentFileName, defines );
    return program;
  }
View Full Code Here

    return ShaderLoader.fromString( vertex, fragment, vertexName, fragmentName, "" );
  }

  public static ShaderProgram fromString( String vertex, String fragment, String vertexName, String fragmentName, String defines ) {
    ShaderProgram.pedantic = ShaderLoader.Pedantic;
    ShaderProgram shader = new ShaderProgram( defines + "\n" + vertex, defines + "\n" + fragment );

    if( !shader.isCompiled() ) {
      Gdx.app.error( "ShaderLoader", shader.getLog() );
      System.exit( -1 );
    }

    return shader;
  }
View Full Code Here

        config.vertexShader != null ? config.vertexShader : getDefaultVertexShader(),
        config.fragmentShader != null ? config.fragmentShader : getDefaultFragmentShader());
  }
 
  public DefaultShader(final Renderable renderable, final Config config, final String prefix, final String vertexShader, final String fragmentShader) {
    this(renderable, config, new ShaderProgram(prefix + vertexShader, prefix + fragmentShader));
  }
View Full Code Here

    u_environmentCubemap = environmentCubemap ? register(Inputs.environmentCubemap, Setters.environmentCubemap) : -1;
  }

  @Override
  public void init () {
    final ShaderProgram program = this.program;
    this.program = null;
    init(program, renderable);
    renderable = null;
   
    dirLightsLoc           = loc(u_dirLights0color);
View Full Code Here

      + "void main()\n"//
      + "{\n" //
      + "  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" //
      + "}";

    ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
    if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
    return shader;
  }
View Full Code Here

        config.vertexShader != null ? config.vertexShader : getDefaultVertexShader(),
        config.fragmentShader != null ? config.fragmentShader : getDefaultFragmentShader());
  }
 
  public DepthShader(final Renderable renderable, final Config config, final String prefix, final String vertexShader, final String fragmentShader) {
    this(renderable, config, new ShaderProgram(prefix + vertexShader, prefix + fragmentShader));
  }
View Full Code Here

      + "uniform sampler2D u_texture;\n" //
      + "void main()\n"//
      + "{\n" //
      + "  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" //
      + "}";
    ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
    if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
    return shader;
  }
View Full Code Here

      + "uniform sampler2D u_texture;\n" //
      + "void main()\n"//
      + "{\n" //
      + "  gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" //
      + "}";
    ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
    if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
    return shader;
  }
View Full Code Here

    // at last lights are rendered over scene
    if (rayHandler.shadows) {

      final Color c = rayHandler.ambientLight;
      ShaderProgram shader = shadowShader;
      if (RayHandler.isDiffuse) {
        shader = diffuseShader;
        shader.begin();
        Gdx.gl20.glBlendFunc(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);
        shader.setUniformf("ambient", c.r, c.g, c.b, c.a);
      } else {
        shader.begin();
        Gdx.gl20.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
        shader.setUniformf("ambient", c.r * c.a, c.g * c.a,
            c.b * c.a, 1f - c.a);
      }
    //  shader.setUniformi("u_texture", 0);
      lightMapMesh.render(shader, GL20.GL_TRIANGLE_FAN);
      shader.end();
    } else if (needed) {

      Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE);
      withoutShadowShader.begin();
    //  withoutShadowShader.setUniformi("u_texture", 0);
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.glutils.ShaderProgram

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.