Guest User

Untitled

a guest
Aug 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. int array to opengl texture in android
  2. mNewTexture = new int[width*height*4]
  3. for(int i=0; i<mRGB.length; i=i+4){
  4.  
  5. mNewTexture[i] = getR(mRGB[i]) ; //R
  6. mNewTexture[i+1] = getG(mRGB[i]) ; //G
  7. mNewTexture[i+2] = getB(mRGB[i]) ; //B
  8. mNewTexture[i+3] = getA(mRGB[i]); //A
  9.  
  10. }
  11.  
  12. gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
  13. gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 1024, 512, 0, GL10.GL_RGBA, GL10.GL_FLOAT, FloatBuffer.wrap(mNewTexture));
  14. gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
Add Comment
Please, Sign In to add comment