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();
	}
void doJob() {
	
	
		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);
		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)
		HwUiRender render = HwUiRender.create(this);
		render.setSurface(tex);
	
		for(int i=0;i<1;++i) {
		long startTime = System.currentTimeMillis();
		render.drawToSurface(view);
		rt.begin()
		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);
	
	}
void dojob() { 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); 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) hwuirender render = hwuirender.create(this); render.setsurface(tex); for(int i=0;i<1;++i) { long starttime = system.currenttimemillis(); render.drawtosurface(view); rt.begin() 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); }