KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to add some efects to the camera in android, I found some things on internet but I got stuck when creating the texture, I use the funcion decodeYUV420SP() that returns me a int[width*height] RGB array with the hex values into each array position, Now, I want to create an openGL texture of this array but i dont know how, I can convert each hex value to its R_G_B separated and put it into opengl but it doesn't work I do something like this: mNewTexture = new int[width*height*4] for(int i=0; i<mRGB.length; i=i+4){ mNewTexture[i] = getR(mRGB[i]) ; //R mNewTexture[i+1] = getG(mRGB[i]) ; //G mNewTexture[i+2] = getB(mRGB[i]) ; //B mNewTexture[i+3] = getA(mRGB[i]); //A } To convert the hex value to RGBA (from 0 to 255) And i do this to convert it to the openGL texture: gl.glBindTexture(GL10.GL_TEXTURE_2D, tex); gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 1024, 512, 0, GL10.GL_RGBA, GL10.GL_FLOAT, FloatBuffer.wrap(mNewTexture)); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); However something is worng, cause it doesn't work... Any idea?
Tags (comma-separated)
Save Edits
Cancel