Forums - Nexus 5: glFramebufferTexture2D failed with OES image as color attachment

2 posts / 0 new
Last post
Nexus 5: glFramebufferTexture2D failed with OES image as color attachment
Join Date: 11 Oct 14
Posts: 1
Posted: Sat, 2014-10-11 02:40

Nexus 5, Android 4.4.2
Adreno 330/ Version: OpenGL ES 3.0 [email protected] AU@  (CL@)

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_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);
// replace GL_TEXTURE_2D with GL_TEXTURE_EXTERNAL_OES doesn't work either


  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Mon, 2014-10-13 13:52

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?



  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.