Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opengl1: Add software gamma ramps / overbright #632

Open
zturtleman opened this issue Jan 18, 2024 · 0 comments
Open

opengl1: Add software gamma ramps / overbright #632

zturtleman opened this issue Jan 18, 2024 · 0 comments

Comments

@zturtleman
Copy link

In the opengl1 renderer with default settings it needs hardware gamma ramps for r_overbrightbits 1 to double the screen brightness after rendering. Custom r_gamma and r_intensity also depend on hardware gamma ramps.

This doesn't work in windowed mode, on some hardware, when using Wayland display protocol on Linux, and recording/streaming in OBS Studio.

SDL 3—still in development—removed hardware gamma ramps altogether and it sounds like sdl2-compat won't support gamma ramps. So instead of overbright being broken in half of the use cases in the future, it will be broken in all of them.

Adding software gamma ramps to opengl1 would be nice even before using SDL 3. It could only be used when hardware gamma ramps aren't available / SDL_SetWindowGammaRamp() fails or r_ignorehwgamma 1.

Implementation

OpenArena engine has r_alternateBrightness which is a clever solution to software overbright. It draws a fullscreen white image with the blend mode srcFactor=GL_DST_COLOR dstFactor=GL_SRC_COLOR (one * screen + one * screen) to double the brightness of the screen. This matches r_overbrightbits 1 and isn't as slow as using a framebuffer object.

This is OpenGL 1.1 API compatible but that doesn't mean it works everywhere. I've read that the ATI Rage Pro graphics card only supports like 4 blend modes and I don't think this is one of them. I'm not sure what happens. I'm not sure if just using r_overbrightbits 0 would be the best solution in that case (no hardware gamma and missing/broken blend mode) or if there is a need for a specific option to disable fullscreen-blend overbright.

Other non-default settings of r_overbrightbits, r_gamma, and r_intensity could fallback to using a framebuffer object and GLSL to apply gamma ramps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant