- added verticle synch option, to enable use:

EnableVSynch=true
This commit is contained in:
Mark Vejvoda 2011-04-14 05:02:32 +00:00
parent a04557ee7f
commit ea90bd0715
3 changed files with 19 additions and 0 deletions

View File

@ -2165,6 +2165,11 @@ int glestMain(int argc, char** argv) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Disabling VBO's\n");
}
if(config.getBool("EnableVSynch","false") == true) {
Window::setTryVSynch(true);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**ENABLED OPENGL VSYNCH**\n");
}
//float pingTime = Socket::getAveragePingMS("soft-haus.com");
//printf("Ping time = %f\n",pingTime);

View File

@ -133,6 +133,7 @@ private:
static bool isKeyPressedDown;
static bool isFullScreen;
static SDL_keysym keystate;
static bool tryVSynch;
static void setLastMouseEvent(int64 lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
static int64 getLastMouseEvent() {return Window::lastMouseEvent;}
@ -164,6 +165,9 @@ public:
Window();
virtual ~Window();
static bool getTryVSynch() { return tryVSynch; }
static void setTryVSynch(bool value) { tryVSynch = value; }
WindowHandle getHandle() {return 0;}
string getText();
int getX() { return 0; }

View File

@ -58,6 +58,8 @@ bool Window::allowAltEnterFullscreenToggle = true;
#endif
int Window::lastShowMouseState = 0;
bool Window::tryVSynch = false;
// ========== PUBLIC ==========
Window::Window() {
@ -360,6 +362,14 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, newStencilBits);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, newDepthBits);
const SDL_VideoInfo *info = SDL_GetVideoInfo();
#ifdef SDL_GL_SWAP_CONTROL
if(Window::tryVSynch == true) {
/* we want vsync for smooth scrolling */
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
}
#endif
// setup LOD bias factor
//const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f);
const float lodBias = max(min(0.0f,4.0f),-4.0f);