Mystery Blue Lines Appear When Displaying Modified Pixels

As part of our project, we are accessing video camera RGB pixels and modifying them to set them to black if they meet certain conditions. This is done before calling GLTexImage2D to display the image as part of a live video feed on an Android device.

We are seeing blue lines appear in consistent locations running horizontally across the screen, and only in regions in which we have modified the pixels. We have checked to confirm that our code has not generated any blue pixels before GLTexImage2D is called, and so believe that this is something to do with that function in concert with the changes we made to the image.

Does anyone know what could be causing this? Any help is greatly appreciated.

-Cooper

On your texture, what are you using for:

  • GL internal format
  • GL external format
  • GL external type

The usual reason is you’re missing:

glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );

The default is 4 (4 bytes). If you’re truly trying to access RGB8 pixels in tightly-packed rows, you’ll likely want 1 here.

See:

I believe that the internal and external formats are both RGBA, the output format is set as RGBA_8888 and the frame buffer is set using 4-byte-per-pixel RGBA.

In terms of GL external type, I’m not sure of that as I don’t see any references to it in the code. Where would you look to determine that?

-Cooper

Here is the line that specifies those types in our code: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, capture_width_, capture_height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);