Hi everyone.

I want to use glReadPixels() to make new texture from current
displayed image.
But alpha value returned from glReadPixels() is always 255,
so I can't make texture with transparency.

Here is a part of my code.
(in GLSurfaceView.Renderer's onSurfaceCreated())

gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_ALPHA_BITS);

object0.draw(gl);
object1.draw(gl);

x = y = 0;
texture_width = texture_height = 128;

ByteBuffer pixels = ByteBuffer.allocate(texture_width * texture_height
* 4);
pixels.order(ByteOrder.nativeOrder());
gl.glReadPixels
(x,y,texture_width,texture_height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,
pixels);

int[] textureNo = new int[1];
gl.glGenTextures(1, textureNo, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureNo[0]);
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, ts, ts, 0,
GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels);

//end

RGB value is OK, but Alpha value is always 255, regardless of the 4th
argument of glClearColor and object's transparent region is filled
with glClearColor()'s RGB value.

Is there any way to make texture with transparency from current
displayed image?

Thanks for your help.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to