Revision 41a81a14
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java | ||
---|---|---|
23 | 23 |
import android.graphics.BitmapFactory; |
24 | 24 |
import android.opengl.EGL14; |
25 | 25 |
import android.opengl.EGLSurface; |
26 |
import android.opengl.GLES20;
|
|
26 |
import android.opengl.GLES30;
|
|
27 | 27 |
import android.os.Looper; |
28 | 28 |
import android.util.Log; |
29 | 29 |
import android.view.Surface; |
... | ... | |
102 | 102 |
|
103 | 103 |
private static void checkGlError(String op) |
104 | 104 |
{ |
105 |
int error = GLES20.glGetError();
|
|
105 |
int error = GLES30.glGetError();
|
|
106 | 106 |
|
107 |
if (error != GLES20.GL_NO_ERROR)
|
|
107 |
if (error != GLES30.GL_NO_ERROR)
|
|
108 | 108 |
{ |
109 | 109 |
String msg = op + ": glError 0x" + Integer.toHexString(error); |
110 | 110 |
Log.e(TAG, msg); |
... | ... | |
190 | 190 |
eglSurface = eglCore.createWindowSurface(surface); |
191 | 191 |
eglCore.makeCurrent(eglSurface); |
192 | 192 |
|
193 |
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
193 |
GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
194 | 194 |
|
195 | 195 |
InputStream is = mView.getContext().getResources().openRawResource(R.raw.monalisa); |
196 | 196 |
Bitmap bmp; |
... | ... | |
266 | 266 |
|
267 | 267 |
eglCore.makeCurrent(eglSurface); |
268 | 268 |
|
269 |
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
|
|
269 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
|
|
270 | 270 |
mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() ); |
271 | 271 |
|
272 | 272 |
eglCore.swapBuffers(eglSurface); |
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!)