@Override public void begin (float fbufWidth, float fbufHeight, boolean flip) { super.begin(fbufWidth, fbufHeight, flip); program.activate(); // TODO: apparently we can avoid glUniform calls because they're part of the program state; so // we can cache the last set values for all these glUniform calls and only set them anew if // they differ... gl.glUniform2f(uHScreenSize, fbufWidth/2f, fbufHeight/2f); gl.glUniform1f(uFlip, flip ? -1 : 1); gl.glBindBuffer(GL_ARRAY_BUFFER, verticesId); gl.glEnableVertexAttribArray(aVertex); gl.glVertexAttribPointer(aVertex, VERTEX_SIZE, GL_SHORT, false, 0, 0); gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementsId); gl.glActiveTexture(GL_TEXTURE0); gl.glUniform1i(uTexture, 0); gl.checkError("UniformQuadBatch begin"); }
private void bindAttribsBufs () { gl.glBindBuffer(GL_ARRAY_BUFFER, verticesId); // bind our stable vertex attributes int stride = vertexStride(); glBindVertAttrib(aMatrix, 4, GL_FLOAT, stride, 0); glBindVertAttrib(aTranslation, 2, GL_FLOAT, stride, 16); glBindVertAttrib(aColor, 2, GL_FLOAT, stride, 24); // bind our changing vertex attributes int offset = stableAttrsSize()*FLOAT_SIZE_BYTES; glBindVertAttrib(aPosition, 2, GL_FLOAT, stride, offset); glBindVertAttrib(aTexCoord, 2, GL_FLOAT, stride, offset+8); gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementsId); gl.glActiveTexture(GL_TEXTURE0); gl.glUniform1i(uTexture, 0); }
private void bindAttribsBufs () { gl.glBindBuffer(GL_ARRAY_BUFFER, verticesId); // bind our stable vertex attributes int stride = vertexStride(); glBindVertAttrib(aMatrix, 4, GL_FLOAT, stride, 0); glBindVertAttrib(aTranslation, 2, GL_FLOAT, stride, 16); glBindVertAttrib(aColor, 2, GL_FLOAT, stride, 24); // bind our changing vertex attributes int offset = stableAttrsSize()*FLOAT_SIZE_BYTES; glBindVertAttrib(aPosition, 2, GL_FLOAT, stride, offset); glBindVertAttrib(aTexCoord, 2, GL_FLOAT, stride, offset+8); gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementsId); gl.glActiveTexture(GL_TEXTURE0); gl.glUniform1i(uTexture, 0); }
@Override public void begin (float fbufWidth, float fbufHeight, boolean flip) { super.begin(fbufWidth, fbufHeight, flip); program.activate(); // TODO: apparently we can avoid glUniform calls because they're part of the program state; so // we can cache the last set values for all these glUniform calls and only set them anew if // they differ... gl.glUniform2f(uHScreenSize, fbufWidth/2f, fbufHeight/2f); gl.glUniform1f(uFlip, flip ? -1 : 1); gl.glBindBuffer(GL_ARRAY_BUFFER, verticesId); gl.glEnableVertexAttribArray(aVertex); gl.glVertexAttribPointer(aVertex, VERTEX_SIZE, GL_SHORT, false, 0, 0); gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementsId); gl.glActiveTexture(GL_TEXTURE0); gl.glUniform1i(uTexture, 0); gl.checkError("UniformQuadBatch begin"); }