Nexus 5, Android 4.4.2
Adreno 330/ Version: OpenGL ES 3.0 [email protected] [email protected] ([email protected])
I could not setup OES image as color attachment.
glFramebufferTexture2D failed with GL_INVALID_OPERATION.
Exact same code work on Mali-4XX devices.
Related code:
// android::GraphicBuffer allocation flags: HAL_PIXEL_FORMAT_RGBA_8888, USAGE_HW_TEXTURE | USAGE_HW_RENDER
// No error
...
const EGLint attrs[] = {
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
EGL_NONE, EGL_NONE
};
image = eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, native_buffer, attrs);
...
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
// No error
...
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
// GL_INVALID_OPERATION raised
// replace GL_TEXTURE_2D with GL_TEXTURE_EXTERNAL_OES doesn't work either
At first glance, your code does seems valid to attach a color buffer to the FBO.
1) Have you reviewed the valid reasons for GL_INVALID_OPERATION being returned?
GL_INVALID_OPERATION is generated if the default framebuffer object name 0 is bound.
GL_INVALID_OPERATION is generated if texture is neither 0 nor the name of an existing texture object.
GL_INVALID_OPERATION is generated if texture is the name of an existing two-dimensional texture object but textarget is not GL_TEXTURE_2D or if texture is the name of an existing cube map texture object but textarget is GL_TEXTURE_2D
2) Have you tried using eglCreateImage instead of eglCreateImageKHR?
3) Is there more code you could share (e.g. FBO creation)?
4) Do you have an apk that duplicates the problem, that we could do some testing with?
thanks