Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:29:48+00:00 2026-05-28T16:29:48+00:00

For performance reasons I have separated my 2D and 3D rendering. I have two

  • 0

For performance reasons I have separated my 2D and 3D rendering. I have two QGLFramebufferObjects for each type because QGLFramebuffer does not support multisampling with GL_TEXTURE_2D as a target, so once drawing is done into the multisampled buffer, it is blitted into a ‘normal’ QGLFramebufferObject where the pixel values are resolved. Once this has been done for one/both of the render types, the buffers are used as texture inputs to a shader that blends the 2D ‘layer’ onto the 3D one.

I should mention that I’m locked into using QGLFramebufferObjects instead of pure OpenGL objects because I use QPainter for all 2D work, and QPainter can only paint onto Qt types.

This process works fine, except the anti-aliasing is too dark, it almost looks like a dark outline:

Bad blending

After doing some research I discovered this was down to using linear colour space instead sRGB (here and here). So I enabled GL_FRAMEBUFFER_SRGB for my FBO blitting, set the texture target internal type for my all FBOs to GL_SRGB8_ALPHA8, and performed sRGB->Linear before the blending calculations in my shader (and back again before the final output).

But it is isn’t working; it either looks too bright, too dark, or exactly the same. Whenever the whole frame is too dark/light, I know it’s because I’ve missed a colour-space conversion. But when it looks exactly the same – what is going on!?

I could really do with someone explaining the order of operations for enabling the GL_FRAMEBUFFER_SRGB state, if blitting will affect the colour space, and which FBOs need to be in sRGB for the anti-aliasing to look correct. Or am I totally wrong, and is it something else entirely that is causing these multisampling artifacts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:29:49+00:00Added an answer on May 28, 2026 at 4:29 pm

    So I enabled GL_FRAMEBUFFER_SRGB for my FBO blitting, set the texture target internal type for my all FBOs to GL_SRGB8_ALPHA8, and performed sRGB->Linear before the blending calculations in my shader (and back again before the final output).

    That made sense right up until the final step.

    An image format that uses the sRGB colorspace means that texture accesses from that texture will automatically be converted from the sRGB colorspace into a linear colorspace. This happens by itself when you fetch texels from the texture. It’s free. So you shouldn’t have to do any “sRGB->Linear” computations at all.

    Similarly, when you have enabled GL_FRAMEBUFFER_SRGB when rendering to an image that uses the sRGB colorspace, values you write to that image are assumed to be linear. By enabling GL_FRAMEBUFFER_SRGB, what you are telling OpenGL to do is to convert the linear values you write to sRGB colorspace values. This is again free, and works just fine with blending and antialiasing. So again, you shouldn’t have to do any manual conversion.

    So really, what you need to do is ensure a properly linear color pipeline. Any textures of yours that were created in the sRGB colorspace should use image formats in the sRGB colorspace. This will ensure that values you get from them in the shader are linear, so lighting math actually works. When you write color values, you need to write them to an sRGB colorspace framebuffer, with GL_FRAMEBUFFER_SRGB enabled. This will ensure that the linear values you write from your shader are properly converted to sRGB for display.

    The last part is that you need to make sure that your display is an sRGB image as well. I know nothing about Qt OpenGL context initialization, but unless they’ve been ignoring OpenGL for the last 4 years or so, there should be some setting you can use to force it to create a context with sRGB colorspace buffers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a std::vector<Obj *> objs (for performance reasons I have pointers not
I have lexer/parser (Generated from an ANTLR grammar file) which (for performance reasons) I
For performance reasons an MVC app should have compilation debug='false' set in its web.config.
I do not want to use cursors for performance reasons. Input Parameters for stored
I have a C# front end and a C++ backend for performance reasons. Now
For performance reasons, I draw the strings for my UITableViewCell in a custom view
I knew of some performance reasons back in the SQL 7 days, but do
I'm writing a program that for performance reasons uses shared memory (sockets and pipes
I am using ListView/DataPager. For performance reasons I page my results at database, using
I've got a web application that, for performance reasons, throws any data sent into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.