私はcreateOffscreenSurface
from grafikaを使用します:
/**
* Creates an off-screen surface.
*/
public void createOffscreenSurface(int width, int height) {
if (mEGLSurface != EGL14.EGL_NO_SURFACE) {
throw new IllegalStateException("surface already created");
}
mEGLSurface = mEglCore.createOffscreenSurface(width, height);
mWidth = width;
mHeight = height;
}
/**
* Creates an EGL surface associated with an offscreen buffer.
*/
public EGLSurface createOffscreenSurface(int width, int height) {
int[] surfaceAttribs = {
EGL14.EGL_WIDTH, width,
EGL14.EGL_HEIGHT, height,
EGL14.EGL_NONE
};
EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig,
surfaceAttribs, 0);
checkEglError("eglCreatePbufferSurface");
if (eglSurface == null) {
throw new RuntimeException("surface was null");
}
return eglSurface;
}
一部のデバイスでは問題なく動作しますが、他のデバイスでは動作しません。エラーメッセージは次のとおりです。
java.lang.RuntimeException: eglCreatePbufferSurface: EGL error: 0x3009
私もググって、次の情報を得ました。
その電話に適したピクセル形式でサーフェス ビューをセットアップする必要があります。これはおそらく PixelFormat.RGB565 (リンク)です。
あなたの表面は実際のディスプレイ表面とは異なるフォーマットであると確信しています。(リンク)
しかし、私はそれを修正するアイデアを持っていません。助言がありますか ?