ARM Community: FBO with GL_RGB color attachment not supported? - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

FBO with GL_RGB color attachment not supported?

#1 User is offline   SuneT 

  • Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 26-October 11

Posted 26 October 2011 - 10:55 AM

Driver info:
EGL_VENDOR: ARM
EGL_VERSION: 1.4 Linux-r2p0-05rel0
GL_RENDERER: Mali-400 MP

Sample code:
GLuint texHandle;
GLuint fboHandle;
GLenum format = GL_RGB;

glGenTextures(1, &texHandle);
glBindTexture(GL_TEXTURE_2D, texHandle);
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, NULL);

glGenFramebuffers(1, &fboHandle));
glBindFramebuffer(GL_FRAMEBUFFER, fboHandle));
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texHandle, 0);

GLenum res = glCheckFramebufferStatus(GL_FRAMEBUFFER);


If I set format to GL_RGBA, the framebuffer status is GL_FRAMEBUFFER_COMPLETE
If I set format to GL_RGB instead, the framebuffer status is GL_FRAMEBUFFER_UNSUPPORTED

So, does this mean that mali does not support rendering to GL_RGB textures? And if so, is support for it implemented in newer driver versions?
0

#2 User is offline   Doug Day 

  • Member
  • Pip
  • Group: Members.
  • Posts: 4
  • Joined: 23-November 10

Posted 26 October 2011 - 01:41 PM

Hi,

In your example, you are trying to create a framebuffer object with RGB of 8-bits per channel. Mali doesn't support this because of memory alignment issues that would impact performance.

It would be better to either try rendering to RGB (565) or, for more precision, use RGBA (8 bit per channel) and just ignore the alpha channel (assuming you don't need it).

Best regards,
Doug
0

#3 User is offline   SuneT 

  • Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 26-October 11

Posted 28 October 2011 - 07:01 AM

Hi Doug,

Thanks for the clarification, I'll use GL_RGBA instead then.
0

#4 User is offline   Habba 

  • Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 15-March 12

Posted 15 March 2012 - 08:39 AM

Sorry to dig up this topic after it has been solved, but I have a question regarding this same issue.

Even though GL_RGB could be considered evil, how is it that it is not supported? More importantly, how am I, as an android developer, to know that GL_RGB is not supported?

I thought that supporting GL_RGB is part of the OpenGL ES 1.1 standard, because it's listed as an accepted value here. I may be wrong, since I'm not an OpenGL ES expert.
0

#5 User is offline   KarthikH 

  • Moderator
  • Pip
  • Group: Moderators
  • Posts: 27
  • Joined: 14-April 10

Posted 15 March 2012 - 03:42 PM

Hi Habba,

Framebuffer object support is a GLES extension that is defined here. If you look towards the end, the document states which formats are required and optional. It clearly mentions that RGB8_OES (sized internal format) is optional.

As Doug mentioned previously, having a 24 bit format causes memory alignment issues. When reading a texel from memory, we would always have to read four bytes (R,G,B,R) with only three (R, G, B) being used. Also, if you need to read the next texel, you would have to read 8 bytes (R from the previous four bytes and next four - G,B,R,G). This is rather inefficient and will cause unnecessary bandwidth on the system. As a result the best formats would either be a 16 bit or a 32 bit format depending on the precision required.

Please let me know if you need any more clarifications.

Best Regards
Karthik
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic