Revision 29246ab4
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
|---|---|---|
| 161 | 161 |
int fH =(int)(mScale*bmpHeight); |
| 162 | 162 |
ByteBuffer buf = ByteBuffer.allocateDirect(fW*fH*4); |
| 163 | 163 |
buf.order(ByteOrder.LITTLE_ENDIAN); |
| 164 |
mOffscreen.setAsInput(); |
|
| 165 | 164 |
|
| 166 |
GLES20.glReadPixels( 0, 0, fW, fH, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); |
|
| 167 |
SaveWorkerThread.newBuffer(buf,fW,fH,mPath); |
|
| 165 |
int textureID = mOffscreen.getTextureID(); |
|
| 166 |
|
|
| 167 |
if( textureID>=0 ) |
|
| 168 |
{
|
|
| 169 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureID); |
|
| 170 |
GLES20.glReadPixels( 0, 0, fW, fH, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); |
|
| 171 |
SaveWorkerThread.newBuffer(buf,fW,fH,mPath); |
|
| 172 |
} |
|
| 173 |
else |
|
| 174 |
{
|
|
| 175 |
android.util.Log.e("Save", "Error trying to read from offscreen FBO");
|
|
| 176 |
} |
|
| 168 | 177 |
|
| 169 | 178 |
isSaving = false; |
| 170 | 179 |
} |
Also available in: Unified diff
Change of API in DistortedFramebuffer.