Render semi-transparent Texture to FBO

Render semi-transparent Texture to FBO


Hi! I’ve been playing with Camera and FBO for some off-screen rendering recently. It worked great but when I try to do the following thing, the FBO got transparency. I wanted it to be opaque.

  1. Set up a camera with CameraFlag::USER1. Attach a FrameBuffer to it.
  2. Generate a Texture2D from raw byte array gridData. In gridData I set some pixels’ alpha value to 0x03 (format is RGBA4444)
  gridData, dataLen, Texture2D::PixelFormat::RGBA4444,
  potWidth, potHeight,
  Size(potWidth, potHeight)
  1. create a Sprite from the texture2D. with camera mask USER1.
  2. create a Sprite from the FrameBuffer and display it on screen.

The result looks OK except for those alpha values are also copied to the resulting FBO, making the texture created from it semi-transparent as well. How to make the result opaque (Without creating an additional background image)? Any help is appreciated. :slight_smile: