I have successfully used SurfaceTexture to draw camera frames on a custom opengl texture without using the transformation matrix provided by android.
Just try defining your vertex and texture indices the way you do for normal texture painting. Like this, for example.
const GLfloat Vertices[] = {0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0, -0.5, -0.5, 0}; const GLubyte Indices[] = { 0, 1, 2, 2, 3, 0 }; const GLfloat Textures[] = { 1.,0., 0.,0., 0.,1., 1.,1. };
You should be able to use surfacetexture the way you use regular texture.
If you want to do some kind of three-dimensional projection, this is a good article on how to create a suitable MVP matrix. Which can be used to multiply by the position in the vertex shader.
Slartibartfast
source share