我使用grafika中的createOffscreenSurface
:
/**
* 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
我还在谷歌上搜索了一下,得到了以下信息:
1.您需要使用适合该手机的像素格式设置表面视图,最有可能的是PixelFormat.RGB565(link)
1.我很确定你的界面与实际的显示界面格式不同。(link)
但是,我没有办法解决这个问题,你有什么建议吗?
1条答案
按热度按时间oxalkeyp1#
用途
来代替