From a55083037917654b7acc931b81d509873eb802ca Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 14 May 2008 21:39:49 +0000 Subject: [PATCH] disable water reflections on pre-DX8ish hardware by default git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1971 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/main.cpp | 2 +- source/src/menus.cpp | 4 +-- source/src/protos.h | 1 + source/src/rendergl.cpp | 56 ++++++++++++++++++++++++----------------- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/source/src/main.cpp b/source/src/main.cpp index 93bf857d..a40bba8a 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -504,7 +504,7 @@ int main(int argc, char **argv) SDL_ShowCursor(0); initlog("gl"); - + gl_checkextensions(); gl_init(scr_w, scr_h, usedcolorbits, useddepthbits, usedfsaa); notexture = textureload("packages/misc/notexture.png"); diff --git a/source/src/menus.cpp b/source/src/menus.cpp index ac9305f9..d387dc8d 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -155,7 +155,7 @@ struct mitemtextinput : mitemtext mitemtextinput(gmenu *parent, char *text, char *value, char *action, char *hoveraction, color *bgcolor) : mitemtext(parent, text, action, hoveraction, bgcolor), defaultvalueexp(value), modified(false) { s_strcpy(input.buf, value); - }; + } virtual int width() { return text_width(input.buf) + text_width(text); } @@ -194,7 +194,7 @@ struct mitemtextinput : mitemtext modified = false; } - virtual void select() { }; + virtual void select() { } void setdefaultvalue() { diff --git a/source/src/protos.h b/source/src/protos.h index a3454b57..f736bdf0 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -182,6 +182,7 @@ extern serverinfo *getconnectedserverinfo(); extern void pingservers(); // rendergl +extern void gl_checkextensions(); extern void gl_init(int w, int h, int bpp, int depth, int fsaa); extern void cleangl(); extern void line(int x1, int y1, float z1, int x2, int y2, float z2); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 384820c6..24884aba 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -21,30 +21,8 @@ void *getprocaddress(const char *name) return SDL_GL_GetProcAddress(name); } -void gl_init(int w, int h, int bpp, int depth, int fsaa) +void gl_checkextensions() { - //#define fogvalues 0.5f, 0.6f, 0.7f, 1.0f - - glViewport(0, 0, w, h); - glClearDepth(1.0); - glDepthFunc(GL_LESS); - glEnable(GL_DEPTH_TEST); - glShadeModel(GL_SMOOTH); - - - glEnable(GL_FOG); - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_DENSITY, 0.25); - glHint(GL_FOG_HINT, GL_NICEST); - - - glEnable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glPolygonOffset(-3.0, -3.0); - - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - const char *vendor = (const char *)glGetString(GL_VENDOR); const char *exts = (const char *)glGetString(GL_EXTENSIONS); const char *renderer = (const char *)glGetString(GL_RENDERER); @@ -71,6 +49,38 @@ void gl_init(int w, int h, int bpp, int depth, int fsaa) hasMDA = true; } + if(!strstr(exts, "GL_EXT_fragment_program")) + { + // not a required extension, but ensures the card has enough power to do reflections + extern int waterreflect, waterrefract; + waterreflect = waterrefract = 0; + } +} + +void gl_init(int w, int h, int bpp, int depth, int fsaa) +{ + //#define fogvalues 0.5f, 0.6f, 0.7f, 1.0f + + glViewport(0, 0, w, h); + glClearDepth(1.0); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_SMOOTH); + + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_DENSITY, 0.25); + glHint(GL_FOG_HINT, GL_NICEST); + + + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glPolygonOffset(-3.0, -3.0); + + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + if(fsaa) glEnable(GL_MULTISAMPLE); inittmus();