Comments (3)
It heavily depends on a renderer: in OpenGL you need to set color mask before each drawcall, in Vulkan - use dedicated greyscale pipeline (-> 2x pipelines in general), as for me - not worth an effort over added renderer(s) complications
from quake3e.
I'm using OpenGL. I haven't messed with the Vulkan renderer yet.
The answer you provided doesn't really explain anything to me that I can understand. Again, I know next to nothing about how OpenGL works, and I find it difficult to grasp. I did try to add the qglColorMask statement before and after the draw functions without any good effect. If set to GL_FALSE it just locks the current frame and won't ever release it. If set to GL_TRUE it does nothing different.
Here is the current greyscale function as I have it written. Perhaps you could take a look and see what's wrong? I have tried running this after R_RenderView as well as calling it from a rendercommand_t. The same thing happens either way. It works without the multitexture buffers, but repeatedly draws if they are enabled.
void FBO_GreyScaleScreen(int x, int y, int width, int height)
{
image_t *image;
// Phoenix - this works, just need to get it to not draw multiple times.
// r_ext_multisample 0 stops it but not sure how to get around it with multisample enabled.
// Must sync render thread so that the GL commands will work.
R_IssuePendingRenderCommands();
qglFinish();
// Use a scratch image from the array to write our framebuffer into
if (!tr.scratchImage[15]) {
tr.scratchImage[15] = R_CreateImage(va("*scratch%i", 15), NULL, NULL, width, height, IMGFLAG_CLAMPTOEDGE | IMGFLAG_RGB | IMGFLAG_NOSCALE);
}
image = tr.scratchImage[15];
GL_Bind(image);
FBO_Bind(GL_READ_FRAMEBUFFER, frameBuffers[0].fbo);
// Copy down the framebuffer onto the scratch image, converting to greyscale by using
// GL_LUMINANCE as the channel instead of GL_RGBA
// Make sure the color is not set funky
qglColor3f(1, 1, 1);
qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, x, y, width, height, 0);
// Set up for 2D rendering
RB_SetGL2D();
// Draw the actual screen overlay. This will cover the full render window
// regardless of FOV or screen width.
qglBegin(GL_QUADS);
qglTexCoord2f(0, 1);
qglVertex2f(x, y);
qglTexCoord2f(1, 1);
qglVertex2f(x + width, y);
qglTexCoord2f(1, 0);
qglVertex2f(x + width, y + height);
qglTexCoord2f(0, 0);
qglVertex2f(x, y + height);
qglEnd();
}
from quake3e.
I was not correct about OpenGL:
- create separate dedicated post-processing ARB/GLSL shader
- do render to the separate render target, save as texture for p.3
- apply post-processing fullscreen quad in correct place (right before UI 2d rendering starts)
This all is OpenGL-specific + slow and not predictable since there is no reliable way to detect transition to UI rendering because some mods may have full 3D UI - thus, not worth an effort
from quake3e.
Related Issues (20)
- Server map rotation fails after a while HOT 8
- Anisotropic filter broken in Latest Build Oct 29, 2023 HOT 3
- [build] `LDFLAGS` in `./Makefile` should be additive HOT 2
- WASAPI: unsupported channel count 6 HOT 1
- Increase max sv_dlRate HOT 2
- Quake 3 enhanced has weird annoying noisy sound when running *WORKAROUND AVAILABLE* HOT 7
- New Cbuf_Add function doesn't play nice with wait command HOT 6
- Shader Scripts Not Ordering Properly Across .shader Files HOT 12
- R_TEXTUREMODE is not behaving persistently through sessions with the Vulkan renderer HOT 3
- All bot models replaced by player selected model HOT 10
- Add OpenArena autodetection HOT 1
- pak0.pk3 is missing on aarch64 Alpine Linux HOT 1
- r_gamma command doesn't work anymore HOT 8
- rj doesn't work anymore HOT 2
- Notes on Raspberry Pi 4 Model B Vulkan support HOT 3
- [Enhancement] Add CVAR to change WINDOW TITLE HOT 3
- win arm32 compiling HOT 4
- [Feature request] Support setting custom extension when using `video-pipe`
- [Feature Request] Recursive directory for auto completion of file types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quake3e.