hack to hopefully make framebuffers alpha-channel opaque

This commit is contained in:
Daniel Gibson 2022-01-22 16:07:51 +01:00
parent d09ccb8539
commit b468203a37
3 changed files with 27 additions and 0 deletions

View file

@ -38,6 +38,7 @@ QGLPROC(glBegin, void, (GLenum mode))
QGLPROC(glBindTexture, void, (GLenum target, GLuint texture))
QGLPROC(glBitmap, void, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap))
QGLPROC(glBlendFunc, void, (GLenum sfactor, GLenum dfactor))
QGLPROC(glBlendEquation, void, (GLenum mode))
QGLPROC(glCallList, void, (GLuint list))
QGLPROC(glCallLists, void, (GLsizei n, GLenum type, const GLvoid *lists))
QGLPROC(glClear, void, (GLbitfield mask))

View file

@ -529,6 +529,31 @@ const void RB_SwapBuffers( const void *data ) {
RB_ShowImages();
}
#if 01 // set alpha chan to 1.0:
bool blendEnabled = qglIsEnabled( GL_BLEND );
//if ( !blendEnabled )
qglEnable( GL_BLEND );
qglBlendEquation( GL_FUNC_ADD );
qglBlendFunc( GL_ONE, GL_ONE );
// draw screen-sized quad with color (0.0, 0.0, 0.0, 1.0)
int w = glConfig.vidWidth, h = glConfig.vidHeight;
int x = 0, y = 0;
qglColor4f( 0.5f, 0.0f, 0.0f, 1.0f );
qglBegin( GL_QUADS );
qglVertex2f( x, y );
qglVertex2f( x + w, y );
qglVertex2f( x + w, y + h );
qglVertex2f( x, y + h );
qglEnd();
// restore default or previous states
qglBlendEquation( GL_FUNC_ADD );
if ( !blendEnabled )
qglDisable( GL_BLEND );
// TODO: theoretically I should restore the glColor value, but I'm sure it'll be set before it's needed anyway
#endif
// force a gl sync if requested
if ( r_finish.GetBool() ) {
qglFinish();

View file

@ -44,6 +44,7 @@ void APIENTRY glBegin(GLenum mode){};
void APIENTRY glBindTexture(GLenum target, GLuint texture){};
void APIENTRY glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap){};
void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor){};
void APIENTRY glBlendEquation(GLenum mode){};
void APIENTRY glCallList(GLuint list){};
void APIENTRY glCallLists(GLsizei n, GLenum type, const GLvoid *lists){};
void APIENTRY glClear(GLbitfield mask){};