Question

This is another take on a question which has no responses. The iPhone has the extension GL_EXT_texture_format_BGRA8888, which is supposed to allow me to use BGRA as the internal format of glTexImage2d.

I have only BGRA data, as that's the only thing I can get from the camera (other than YUV which I'm not ready to deal with).

How can I use BGRA with glReadPixels? Anything I try gives me a black screen!

Was it helpful?

Solution

According to the OpenGL ES 2.0 specification, glReadPixels() only supports RGBA as the format to read back from your FBO. I believe the extension you quote there only allows for BGRA pixel format data to be provided to your texture, not that you can read back an FBO in BGRA format.

As Ben suggests, you can just swizzle the color components in your fragment shader if you need to have the end result be BGRA.

OTHER TIPS

Did you check for OpenGL errors after creating and loading the texture?

Did you bind the texture?

Did you enable texture mapping with glEnable?

Did you specify texture coordinates for each vertex of your polygon?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top