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

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

Introduction

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

Prototype

int GL_ACTIVE_ATTRIBUTES

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

Click Source Link

Usage

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

License:Apache License

private void fetchAttributes() {
    params.clear();/*from  w w w.ja v  a2 s.  c  om*/
    Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_ATTRIBUTES, params);
    int numAttributes = params.get(0);

    attributeNames = new String[numAttributes];

    for (int i = 0; i < numAttributes; i++) {
        params.clear();
        params.put(0, 1);
        type.clear();
        String name = Gdx.gl20.glGetActiveAttrib(program, i, params, type);
        int location = Gdx.gl20.glGetAttribLocation(program, name);
        attributes.put(name, location);
        attributeTypes.put(name, type.get(0));
        attributeSizes.put(name, params.get(0));
        attributeNames[i] = name;
    }
}