Revision 41a81a14
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
import android.graphics.Bitmap; |
46 | 46 |
import android.graphics.BitmapFactory; |
47 |
import android.opengl.GLES20;
|
|
47 |
import android.opengl.GLES30;
|
|
48 | 48 |
import android.opengl.GLSurfaceView; |
49 | 49 |
import android.os.Environment; |
50 | 50 |
|
... | ... | |
148 | 148 |
|
149 | 149 |
public void onDrawFrame(GL10 glUnused) |
150 | 150 |
{ |
151 |
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
|
|
151 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
|
|
152 | 152 |
|
153 | 153 |
long time = System.currentTimeMillis(); |
154 | 154 |
|
... | ... | |
168 | 168 |
|
169 | 169 |
if( textureID>=0 ) |
170 | 170 |
{ |
171 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureID);
|
|
172 |
GLES20.glReadPixels( 0, 0, fW, fH, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf);
|
|
171 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, textureID);
|
|
172 |
GLES30.glReadPixels( 0, 0, fW, fH, GLES30.GL_RGBA, GLES30.GL_UNSIGNED_BYTE, buf);
|
|
173 | 173 |
SaveWorkerThread.newBuffer(buf,fW,fH,mPath); |
174 | 174 |
} |
175 | 175 |
else |
... | ... | |
223 | 223 |
|
224 | 224 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) |
225 | 225 |
{ |
226 |
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
226 |
GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
227 | 227 |
|
228 | 228 |
InputStream is = mView.getContext().getResources().openRawResource(R.raw.girl); |
229 | 229 |
Bitmap bitmap; |
Also available in: Unified diff
Try using OpenGL ES 3.0 everywhere (but if device does not support it, try creating 2.0 context - this is important because of the emulator!)