/*sSimpleFS*/
void doJob() {
		//mRenderThread = new RenderThread(getResources(), surface, v);
		//init
		final TextureView tv = (TextureView) findViewById(R.id.textureView1);
		SurfaceTexture surface = tv.getSurfaceTexture();
		TexSurfaceRenderTarget rt = new TexSurfaceRenderTarget();
		View view = getWindow().getDecorView();
		rt.init(surface);
		rt.begin();
		int[] buf = new int[1];
		glGenTextures(1, buf, 0);
		int texName = buf[0];
		glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES , texName);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		FloatBuffer triangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length
				* FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
		triangleVertices.put(mTriangleVerticesData).position(0);
		int program = buildProgram(sSimpleVS, sBasicFS /*sSimpleFS*/);
		int attribPosition = glGetAttribLocation(program, "position");
		checkGlError();
		int attribTexCoords = glGetAttribLocation(program, "texCoords");
		checkGlError();
		int uniformTexture = glGetUniformLocation(program, "texture");
		checkGlError();
	    int textureTranformHandle = glGetUniformLocation(program, "textureTransform");
		checkGlError();
		SurfaceTexture tex = new SurfaceTexture(texName);//TODO: wait for onFrameAvailable() ??
		HwUiRender render = HwUiRender.create(this);
		render.setSurface(tex);
		//draw
		for(int i=0;i<1;++i) {
		long startTime = System.currentTimeMillis();
		render.drawToSurface(view);
		rt.begin();//TODO: replace on check & makecurrent
		tex.updateTexImage();
		float[] texTransform = new float[16];
		tex.getTransformMatrix(texTransform);
		glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES , texName);
		checkGlError();
		glUseProgram(program);
		checkGlError();
		glEnableVertexAttribArray(attribPosition);
		checkGlError();
		glEnableVertexAttribArray(attribTexCoords);
		checkGlError();
		glUniform1i(uniformTexture, 0);
		glUniformMatrix4fv(textureTranformHandle, 1, false, texTransform, 0);
		checkGlError();
		triangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
		glVertexAttribPointer(attribPosition, 3, GL_FLOAT, false,
				TRIANGLE_VERTICES_DATA_STRIDE_BYTES, triangleVertices);
		checkGlError();
		triangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
		glVertexAttribPointer(attribTexCoords, 3, GL_FLOAT, false,
				TRIANGLE_VERTICES_DATA_STRIDE_BYTES, triangleVertices);
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
		rt.end();
		mToggleButton.setText("" + (System.currentTimeMillis() - startTime));
		}
		render.setSurface(null);
		//rt.cleanup();
	}
* FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
triangleVertices.put(mTriangleVerticesData).position(0);
int program = buildProgram(sSimpleVS, sBasicFS /*sSimpleFS*/);
int attribPosition = glGetAttribLocation(program, "position");
checkGlError();
glGenTextures(1, buf, 0);
int texName = buf[0];
glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES , texName);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
FloatBuffer triangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length
* FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
triangleVertices.put(mTriangleVerticesData).position(0);
int program = buildProgram(sSimpleVS, sBasicFS /*sSimpleFS*/);
int attribPosition = glGetAttribLocation(program, "position");
checkGlError();
int attribTexCoords = glGetAttribLocation(program, "texCoords");
checkGlError();
int uniformTexture = glGetUniformLocation(program, "texture");
checkGlError();
int textureTranformHandle = glGetUniformLocation(program, "textureTransform");
checkGlError();
SurfaceTexture tex = new SurfaceTexture(texName);//TODO: wait for onFrameAvailable() ??
HwUiRender render = HwUiRender.create(this);
void doJob() {
//mRenderThread = new RenderThread(getResources(), surface, v);
//init
final TextureView tv = (TextureView) findViewById(R.id.textureView1);
SurfaceTexture surface = tv.getSurfaceTexture();
TexSurfaceRenderTarget rt = new TexSurfaceRenderTarget();
View view = getWindow().getDecorView();
rt.init(surface);
rt.begin();
int[] buf = new int[1];
glGenTextures(1, buf, 0);
int texName = buf[0];
glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES , texName);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
FloatBuffer triangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length
* FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
triangleVertices.put(mTriangleVerticesData).position(0);
int program = buildProgram(sSimpleVS, sBasicFS /*sSimpleFS*/);
int attribPosition = glGetAttribLocation(program, "position");
checkGlError();
int attribTexCoords = glGetAttribLocation(program, "texCoords");
checkGlError();
int uniformTexture = glGetUniformLocation(program, "texture");
checkGlError();
int textureTranformHandle = glGetUniformLocation(program, "textureTransform");
checkGlError();
SurfaceTexture tex = new SurfaceTexture(texName);//TODO: wait for onFrameAvailable() ??
HwUiRender render = HwUiRender.create(this);
render.setSurface(tex);
//draw
for(int i=0;i<1;++i) {
long startTime = System.currentTimeMillis();
render.drawToSurface(view);
rt.begin();//TODO: replace on check & makecurrent
tex.updateTexImage();
float[] texTransform = new float[16];
tex.getTransformMatrix(texTransform);
glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES , texName);