Example usage for com.badlogic.gdx.graphics GL20 GL_ACTIVE_UNIFORMS

List of usage examples for com.badlogic.gdx.graphics GL20 GL_ACTIVE_UNIFORMS

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 GL_ACTIVE_UNIFORMS.

Prototype

int GL_ACTIVE_UNIFORMS

To view the source code for com.badlogic.gdx.graphics GL20 GL_ACTIVE_UNIFORMS.

Click Source Link

Usage

From source file:net.mgsx.game.examples.gpu.utils.ShaderProgramEx.java

License:Apache License

private void fetchUniforms() {
    params.clear();//from w ww  . j av a  2 s  . c om
    Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_UNIFORMS, params);
    int numUniforms = params.get(0);

    uniformNames = new String[numUniforms];

    for (int i = 0; i < numUniforms; i++) {
        params.clear();
        params.put(0, 1);
        type.clear();
        String name = Gdx.gl20.glGetActiveUniform(program, i, params, type);
        int location = Gdx.gl20.glGetUniformLocation(program, name);
        uniforms.put(name, location);
        uniformTypes.put(name, type.get(0));
        uniformSizes.put(name, params.get(0));
        uniformNames[i] = name;
    }
}