Clear render buffer on allocate, fixes corrupt screen issue

Use GL_RGB16_F instead of GL_RGBA16_F for hdr render buffer
This commit is contained in:
James Canete 2012-04-04 02:35:11 +00:00
parent 481aa033cf
commit 51d3c26bc5
2 changed files with 10 additions and 3 deletions

View file

@ -386,7 +386,7 @@ void FBO_Init(void)
hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
{
hdrFormat = GL_RGBA16F_ARB;
hdrFormat = GL_RGB16F_ARB;
}
qglGetIntegerv(GL_MAX_SAMPLES_EXT, &multisample);
@ -439,6 +439,13 @@ void FBO_Init(void)
R_CheckFBO(tr.renderFbo);
}
// clear render buffer
// this fixes the corrupt screen bug with r_hdr 1 on older hardware
FBO_Bind(tr.renderFbo);
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
FBO_Bind(NULL);
#ifdef REACTION
{

View file

@ -2706,7 +2706,7 @@ void R_CreateBuiltinImages( void ) {
hdrFormat = GL_RGBA8;
if (r_hdr->integer && glRefConfig.framebufferObject && glRefConfig.textureFloat)
hdrFormat = GL_RGBA16F_ARB;
hdrFormat = GL_RGB16F_ARB;
tr.renderImage = R_CreateImage2("_render", NULL, width, height, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat);
#ifdef REACTION
@ -2734,7 +2734,7 @@ void R_CreateBuiltinImages( void ) {
unsigned short sdata[4];
void *p;
if (hdrFormat == GL_RGBA16F_ARB)
if (hdrFormat == GL_RGB16F_ARB)
{
sdata[0] = FloatToHalf(0.0f);
sdata[1] = FloatToHalf(0.45f);