I’m trying to draw something with OpenGL ES on the surface of Imagereader. I create EGL context and surface for it. And everything work fine, when the imagereader size is smaller then GL_MAX_VIEWPORT_DIMS, which is 8192 on my device. I can get a good picture form it.
But when the size is large then 8192, like 8224, the output image still leaving some paddding can’t be draw. Here is the output image.
Even if I try to use glViewport(0, 32, width, 8192), the rendering result move offset up, but still can’t over the padding(8192~8224). But glclear command can make the background clear to the target color(In my case, it’s red).
It’s there any way to draw in the pading part of the surface?
Here is my code:
mImageReader = ImageReader.newInstance(
size.getWidth(),
size.getHeight(),
PixelFormat.RGBA_8888,
// PixelFormat.RGB_888,
// ImageFormat.JPEG,
1);
// mReaderSurface = new EglWindowSurface(core, mImageReader.getSurface(), null);
mReaderSurface = core.createWindowSurface2(mImageReader.getSurface());
public EGLSurface createWindowSurface2(Object surface) {
if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) {
throw new RuntimeException("invalid surface: " + surface);
}
// Create a window surface, and attach it to the Surface we received.
int[] surfaceAttribs = {
EGL14.EGL_NONE
};
int[] attribList = {
EGL14.EGL_RED_SIZE, 8,
EGL14.EGL_GREEN_SIZE, 8,
EGL14.EGL_BLUE_SIZE, 8,
EGL14.EGL_ALPHA_SIZE, 8,
EGL14.EGL_DEPTH_SIZE, 16,
EGL14.EGL_NONE
};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfigs = new int[1];
if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
numConfigs, 0)) {
Log.e(TAG, "createWindowSurface2: ");
return null;
}
EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], surface,
surfaceAttribs, 0);
checkEglError("eglCreateWindowSurface");
if (eglSurface == null) {
throw new RuntimeException("surface was null");
}
return eglSurface;
}