package com.example.glsample; import java.util.concurrent.LinkedBlockingQueue; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import android.annotation.TargetApi; import android.app.Activity; import android.opengl.EGL14; import android.opengl.GLES10; import android.os.Build; import android.os.Bundle; import android.view.SurfaceHolder; @TargetApi(17) public class MyActivity extends Activity implements SurfaceHolder.Callback2 { private EGL10 mEGL; private EGLDisplay mDisplay; private EGLContext mRendererContext; private EGLContext mWorkerContext; private EGLSurface mRendererSurface; private EGLSurface mWorkerSurface; private LinkedBlockingQueue<Runnable> mRendererQueue; private LinkedBlockingQueue<Runnable> mWorkerQueue; private MyGLThread mRendererThread; private MyGLThread mWorkerThread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().takeSurface(this); } @Override public void surfaceCreated(SurfaceHolder holder) { mEGL = (EGL10) EGLContext.getEGL(); mDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] versions = new int[2]; mEGL.eglInitialize(mDisplay, versions); EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; int[] configAttrs = { EGL10.EGL_RED_SIZE, 8, EGL10.EGL_GREEN_SIZE, 8, EGL10.EGL_BLUE_SIZE, 8, EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE }; mEGL.eglChooseConfig(mDisplay, configAttrs, configs, 1, numConfigs); EGLConfig config = configs[0]; int[] windowSurfaceAttrs = { EGL10.EGL_NONE }; mRendererSurface = mEGL.eglCreateWindowSurface(mDisplay, config, holder.getSurface(), windowSurfaceAttrs); int[] pbufferSurfaceAttrs = { EGL10.EGL_NONE }; mWorkerSurface = mEGL.eglCreatePbufferSurface(mDisplay, config, pbufferSurfaceAttrs); int[] contextAttrs = { EGL10.EGL_NONE }; mRendererContext = mEGL.eglCreateContext(mDisplay, config, EGL10.EGL_NO_CONTEXT, contextAttrs); mWorkerContext = mEGL.eglCreateContext(mDisplay, config, mRendererContext, contextAttrs); mRendererQueue = new LinkedBlockingQueue<Runnable>(); mWorkerQueue = new LinkedBlockingQueue<Runnable>(); mRendererThread = new MyGLThread(mEGL, mDisplay, mRendererSurface, mRendererContext, mRendererQueue); mRendererThread.start(); mWorkerThread = new MyGLThread(mEGL, mDisplay, mWorkerSurface, mWorkerContext, mWorkerQueue); mWorkerThread.start(); @Override public void run() { drawFrame(); mRendererQueue.add(this); mEGL.eglSwapBuffers(mDisplay, mRendererSurface); } }); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceRedrawNeeded(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { mRendererThread.quit(); mWorkerThread.quit(); mEGL.eglDestroyContext(mDisplay, mRendererContext); mEGL.eglDestroyContext(mDisplay, mWorkerContext); mEGL.eglDestroySurface(mDisplay, mRendererSurface); mEGL.eglDestroySurface(mDisplay, mWorkerSurface); mEGL.eglTerminate(mDisplay); } void drawFrame() { GLES10.glClearColor(0, 0, 1, 1); GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT); // ... } } private EGL10 mEGL; private EGLDisplay mDisplay; private EGLSurface mSurface; private EGLContext mContext; private LinkedBlockingQueue<Runnable> mQueue; private boolean quit; MyGLThread(EGL10 egl, EGLDisplay display, EGLSurface surface, EGLContext context, LinkedBlockingQueue<Runnable> queue) { this.mEGL = egl; this.mDisplay = display; this.mSurface = surface; this.mContext = context; this.mQueue = queue; } void quit() { quit = true; interrupt(); try { join(); throw new AssertionError(e); } } @Override public void run() { try { mEGL.eglMakeCurrent(mDisplay, mSurface, mSurface, mContext); while (!quit) { mQueue.take().run(); } if (!quit) { throw new AssertionError(e); } } finally { mEGL.eglMakeCurrent(mDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); if (Build.VERSION.SDK_INT >= 17) { EGL14.eglReleaseThread(); } } } }
Standard input is empty
Main.java:20: error: class MyActivity is public, should be declared in a file named MyActivity.java public class MyActivity extends Activity implements SurfaceHolder.Callback2 { ^ Main.java:5: error: package javax.microedition.khronos.egl does not exist import javax.microedition.khronos.egl.EGL10; ^ Main.java:6: error: package javax.microedition.khronos.egl does not exist import javax.microedition.khronos.egl.EGLConfig; ^ Main.java:7: error: package javax.microedition.khronos.egl does not exist import javax.microedition.khronos.egl.EGLContext; ^ Main.java:8: error: package javax.microedition.khronos.egl does not exist import javax.microedition.khronos.egl.EGLDisplay; ^ Main.java:9: error: package javax.microedition.khronos.egl does not exist import javax.microedition.khronos.egl.EGLSurface; ^ Main.java:11: error: package android.annotation does not exist import android.annotation.TargetApi; ^ Main.java:12: error: package android.app does not exist import android.app.Activity; ^ Main.java:13: error: package android.opengl does not exist import android.opengl.EGL14; ^ Main.java:14: error: package android.opengl does not exist import android.opengl.GLES10; ^ Main.java:15: error: package android.os does not exist import android.os.Build; ^ Main.java:16: error: package android.os does not exist import android.os.Bundle; ^ Main.java:17: error: package android.view does not exist import android.view.SurfaceHolder; ^ Main.java:20: error: cannot find symbol public class MyActivity extends Activity implements SurfaceHolder.Callback2 { ^ symbol: class Activity Main.java:20: error: package SurfaceHolder does not exist public class MyActivity extends Activity implements SurfaceHolder.Callback2 { ^ Main.java:19: error: cannot find symbol @TargetApi(17) ^ symbol: class TargetApi Main.java:21: error: cannot find symbol private EGL10 mEGL; ^ symbol: class EGL10 location: class MyActivity Main.java:22: error: cannot find symbol private EGLDisplay mDisplay; ^ symbol: class EGLDisplay location: class MyActivity Main.java:23: error: cannot find symbol private EGLContext mRendererContext; ^ symbol: class EGLContext location: class MyActivity Main.java:24: error: cannot find symbol private EGLContext mWorkerContext; ^ symbol: class EGLContext location: class MyActivity Main.java:25: error: cannot find symbol private EGLSurface mRendererSurface; ^ symbol: class EGLSurface location: class MyActivity Main.java:26: error: cannot find symbol private EGLSurface mWorkerSurface; ^ symbol: class EGLSurface location: class MyActivity Main.java:33: error: cannot find symbol protected void onCreate(Bundle savedInstanceState) { ^ symbol: class Bundle location: class MyActivity Main.java:39: error: cannot find symbol public void surfaceCreated(SurfaceHolder holder) { ^ symbol: class SurfaceHolder location: class MyActivity Main.java:91: error: cannot find symbol public void surfaceChanged(SurfaceHolder holder, int format, int width, ^ symbol: class SurfaceHolder location: class MyActivity Main.java:96: error: cannot find symbol public void surfaceRedrawNeeded(SurfaceHolder holder) { ^ symbol: class SurfaceHolder location: class MyActivity Main.java:100: error: cannot find symbol public void surfaceDestroyed(SurfaceHolder holder) { ^ symbol: class SurfaceHolder location: class MyActivity Main.java:118: error: cannot find symbol private EGL10 mEGL; ^ symbol: class EGL10 location: class MyGLThread Main.java:119: error: cannot find symbol private EGLDisplay mDisplay; ^ symbol: class EGLDisplay location: class MyGLThread Main.java:120: error: cannot find symbol private EGLSurface mSurface; ^ symbol: class EGLSurface location: class MyGLThread Main.java:121: error: cannot find symbol private EGLContext mContext; ^ symbol: class EGLContext location: class MyGLThread Main.java:125: error: cannot find symbol MyGLThread(EGL10 egl, EGLDisplay display, EGLSurface surface, ^ symbol: class EGL10 location: class MyGLThread Main.java:125: error: cannot find symbol MyGLThread(EGL10 egl, EGLDisplay display, EGLSurface surface, ^ symbol: class EGLDisplay location: class MyGLThread Main.java:125: error: cannot find symbol MyGLThread(EGL10 egl, EGLDisplay display, EGLSurface surface, ^ symbol: class EGLSurface location: class MyGLThread Main.java:126: error: cannot find symbol EGLContext context, LinkedBlockingQueue<Runnable> queue) { ^ symbol: class EGLContext location: class MyGLThread Main.java:34: error: cannot find symbol super.onCreate(savedInstanceState); ^ symbol: variable super location: class MyActivity Main.java:35: error: cannot find symbol getWindow().takeSurface(this); ^ symbol: method getWindow() location: class MyActivity Main.java:32: error: method does not override or implement a method from a supertype @Override ^ Main.java:40: error: cannot find symbol mEGL = (EGL10) EGLContext.getEGL(); ^ symbol: class EGL10 location: class MyActivity Main.java:40: error: cannot find symbol mEGL = (EGL10) EGLContext.getEGL(); ^ symbol: variable EGLContext location: class MyActivity Main.java:42: error: cannot find symbol mDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); ^ symbol: variable EGL10 location: class MyActivity Main.java:47: error: cannot find symbol EGLConfig[] configs = new EGLConfig[1]; ^ symbol: class EGLConfig location: class MyActivity Main.java:47: error: cannot find symbol EGLConfig[] configs = new EGLConfig[1]; ^ symbol: class EGLConfig location: class MyActivity Main.java:49: error: cannot find symbol int[] configAttrs = { EGL10.EGL_RED_SIZE, 8, EGL10.EGL_GREEN_SIZE, 8, ^ symbol: variable EGL10 location: class MyActivity Main.java:49: error: cannot find symbol int[] configAttrs = { EGL10.EGL_RED_SIZE, 8, EGL10.EGL_GREEN_SIZE, 8, ^ symbol: variable EGL10 location: class MyActivity Main.java:50: error: cannot find symbol EGL10.EGL_BLUE_SIZE, 8, EGL10.EGL_DEPTH_SIZE, 16, ^ symbol: variable EGL10 location: class MyActivity Main.java:50: error: cannot find symbol EGL10.EGL_BLUE_SIZE, 8, EGL10.EGL_DEPTH_SIZE, 16, ^ symbol: variable EGL10 location: class MyActivity Main.java:51: error: cannot find symbol EGL10.EGL_NONE }; ^ symbol: variable EGL10 location: class MyActivity Main.java:53: error: cannot find symbol EGLConfig config = configs[0]; ^ symbol: class EGLConfig location: class MyActivity Main.java:55: error: cannot find symbol int[] windowSurfaceAttrs = { EGL10.EGL_NONE }; ^ symbol: variable EGL10 location: class MyActivity Main.java:59: error: cannot find symbol int[] pbufferSurfaceAttrs = { EGL10.EGL_NONE }; ^ symbol: variable EGL10 location: class MyActivity Main.java:63: error: cannot find symbol int[] contextAttrs = { EGL10.EGL_NONE }; ^ symbol: variable EGL10 location: class MyActivity Main.java:65: error: cannot find symbol EGL10.EGL_NO_CONTEXT, contextAttrs); ^ symbol: variable EGL10 location: class MyActivity Main.java:38: error: method does not override or implement a method from a supertype @Override ^ Main.java:90: error: method does not override or implement a method from a supertype @Override ^ Main.java:95: error: method does not override or implement a method from a supertype @Override ^ Main.java:99: error: method does not override or implement a method from a supertype @Override ^ Main.java:111: error: cannot find symbol GLES10.glClearColor(0, 0, 1, 1); ^ symbol: variable GLES10 location: class MyActivity Main.java:112: error: cannot find symbol GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT); ^ symbol: variable GLES10 location: class MyActivity Main.java:112: error: cannot find symbol GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT); ^ symbol: variable GLES10 location: class MyActivity Main.java:112: error: cannot find symbol GLES10.glClear(GLES10.GL_COLOR_BUFFER_BIT | GLES10.GL_DEPTH_BUFFER_BIT); ^ symbol: variable GLES10 location: class MyActivity Main.java:156: error: cannot find symbol mEGL.eglMakeCurrent(mDisplay, EGL10.EGL_NO_SURFACE, ^ symbol: variable EGL10 location: class MyGLThread Main.java:157: error: cannot find symbol EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); ^ symbol: variable EGL10 location: class MyGLThread Main.java:157: error: cannot find symbol EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); ^ symbol: variable EGL10 location: class MyGLThread Main.java:158: error: package Build does not exist if (Build.VERSION.SDK_INT >= 17) { ^ Main.java:159: error: cannot find symbol EGL14.eglReleaseThread(); ^ symbol: variable EGL14 location: class MyGLThread 66 errors
Standard output is empty