/** Creates a triangle batch with the supplied custom shader program. */ public TriangleBatch (GL20 gl, Source source) { super(gl); delayedBinding = "Intel".equals(gl.glGetString(GL20.GL_VENDOR)); program = new GLProgram(gl, source.vertex(), source.fragment()); uTexture = program.getUniformLocation("u_Texture"); uHScreenSize = program.getUniformLocation("u_HScreenSize"); uFlip = program.getUniformLocation("u_Flip"); aMatrix = program.getAttribLocation("a_Matrix"); aTranslation = program.getAttribLocation("a_Translation"); aColor = program.getAttribLocation("a_Color"); aPosition = program.getAttribLocation("a_Position"); aTexCoord = program.getAttribLocation("a_TexCoord"); // create our vertex and index buffers stableAttrs = new float[stableAttrsSize()]; vertices = new float[START_VERTS*vertexSize()]; elements = new short[START_ELEMS]; // create our GL buffers int[] ids = new int[2]; gl.glGenBuffers(2, ids, 0); verticesId = ids[0]; elementsId = ids[1]; gl.checkError("TriangleBatch end ctor"); }
/** Creates a triangle batch with the supplied custom shader program. */ public TriangleBatch (GL20 gl, Source source) { super(gl); delayedBinding = "Intel".equals(gl.glGetString(GL20.GL_VENDOR)); program = new GLProgram(gl, source.vertex(), source.fragment()); uTexture = program.getUniformLocation("u_Texture"); uHScreenSize = program.getUniformLocation("u_HScreenSize"); uFlip = program.getUniformLocation("u_Flip"); aMatrix = program.getAttribLocation("a_Matrix"); aTranslation = program.getAttribLocation("a_Translation"); aColor = program.getAttribLocation("a_Color"); aPosition = program.getAttribLocation("a_Position"); aTexCoord = program.getAttribLocation("a_TexCoord"); // create our vertex and index buffers stableAttrs = new float[stableAttrsSize()]; vertices = new float[START_VERTS*vertexSize()]; elements = new short[START_ELEMS]; // create our GL buffers int[] ids = new int[2]; gl.glGenBuffers(2, ids, 0); verticesId = ids[0]; elementsId = ids[1]; gl.checkError("TriangleBatch end ctor"); }
maxQuads = maxVecs / vec4sPerQuad(); program = new GLProgram(gl, source.vertex(this), source.fragment()); uTexture = program.getUniformLocation("u_Texture"); uHScreenSize = program.getUniformLocation("u_HScreenSize");
maxQuads = maxVecs / vec4sPerQuad(); program = new GLProgram(gl, source.vertex(this), source.fragment()); uTexture = program.getUniformLocation("u_Texture"); uHScreenSize = program.getUniformLocation("u_HScreenSize");