Add a fallback for the map preview when drivers report they have FBO, but we detect a FBO error.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5835 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2008-08-17 18:35:22 +00:00
parent 077cfee020
commit ebecb854b1
2 changed files with 18 additions and 7 deletions

View File

@ -62,6 +62,7 @@ GLuint fbo; // Our handle to the FBO
GLuint FBOtexture; // The texture we are going to use
GLuint FBOdepthbuffer; // Our handle to the depth render buffer
static BOOL FBOinit = false;
BOOL bFboProblem = false; // hack to work around people with bad drivers. (*cough*intel*cough*)
/* Initialise the double buffered display */
BOOL screenInitialise(
@ -421,6 +422,7 @@ void checkGLErrors(const char *label)
return;
debug(LOG_ERROR, "OpenGL ERROR in %s: %s, (0x%0x)", label, gluErrorString(errCode), errCode);
bFboProblem = true; // we have a issue with the FBO, fallback to normal routine
}
BOOL Init_FBO(unsigned int width, unsigned int height)

View File

@ -97,8 +97,8 @@ extern char MultiPlayersPath[PATH_MAX];
extern GLuint fbo; // Our handle to the FBO
extern GLuint FBOtexture; // The texture we are going to use
extern GLuint FBOdepthbuffer; // Our handle to the depth render buffer
extern BOOL bSendingMap;
extern BOOL bFboProblem; // hack to work around people with bad drivers. (*cough*intel*cough*)
extern BOOL bSendingMap; // used to indicate we are sending a map
extern void intDisplayTemplateButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours);
@ -302,8 +302,10 @@ void loadMapPreview(void)
memset(playerpos,0x77,sizeof(playerpos));
// color our texture with clancolors @ correct position
plotStructurePreview16(imageData, scale, offX2, offY2,playerpos);
glGetError(); // clear openGL errorcodes
// and now, for those that have FBO available on their card
if(Init_FBO(BACKDROP_HACK_WIDTH,BACKDROP_HACK_HEIGHT))
// added hack to work around bad drivers that report FBO available, when it is not.
if(Init_FBO(BACKDROP_HACK_WIDTH,BACKDROP_HACK_HEIGHT) && !bFboProblem)
{
// Save the view port and set it to the size of the texture
glPushAttrib(GL_VIEWPORT_BIT);
@ -373,15 +375,22 @@ void loadMapPreview(void)
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glPopAttrib();
screen_Upload(fboData);
// if we detected a error, then we must fallback to old texture, or user will not see anything.
if(!bFboProblem)
{
screen_Upload(fboData);
}
else
{
screen_Upload(imageData);
}
checkGLErrors("Done with FBO routine");
}
else
{ // no FBO was available, just show them what we got.
{
// no FBO was available, just show them what we got.
screen_Upload(imageData);
}
free(fboData);