낡은 질문이지만 코드에 대한 답장을 보내고 싶습니다.GLES20.glReadPixel too slow
다음은 실시간으로보기에는 너무 느립니다. 나중에 OpenTOK 화면 공유와 함께 사용하려고합니다. 어떤 빠른 대용품?
ByteBuffer bb = ByteBuffer.allocateDirect(screenshotSize * 4);
bb.order(ByteOrder.nativeOrder());
GLES20.glReadPixels(0, 0, width, height, GL_RGBA,
GL10.GL_UNSIGNED_BYTE, bb);
int pixelsBuffer[] = new int[screenshotSize];
bb.asIntBuffer().get(pixelsBuffer);
final Bitmap bitmap = Bitmap.createBitmap(width, height,
Bitmap.Config.RGB_565);
bitmap.setPixels(pixelsBuffer, screenshotSize - width, -width,
0, 0, width, height);
pixelsBuffer = null;
short sBuffer[] = new short[screenshotSize];
ShortBuffer sb = ShortBuffer.wrap(sBuffer);
bitmap.copyPixelsToBuffer(sb);
for (int i = 0; i < screenshotSize; ++i) {
short v = sBuffer[i];
sBuffer[i] = (short) (((v & 0x1f) << 11) | (v & 0x7e0) | ((v & 0xf800) >> 11));
}
sb.rewind();
bitmap.copyPixelsFromBuffer(sb);
PS : 나는 이미 GL_RGB 및 GL_BGRA을 시도했지만 여전히 느리고 난 단지 검은 화면을 얻을.
[OpenGL에서 glReadPixels보다 빠른 픽셀 읽기] 가능한 복제본 (https://stackoverflow.com/questions/25127751/opengl-read-pixels-father-than-glreadpixels) – yakobom