From e5a13c5ab0a34ab122a9658a02500eb21916afa5 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 22 Jun 2010 08:12:31 +0200 Subject: [PATCH] Fixed: #993 Floating Point Exception in NL3D::CDriverGL::getModes on Linux --- code/nel/src/3d/driver/opengl/driver_opengl_window.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index d2c85c715..d456bb74c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1200,8 +1200,9 @@ bool CDriverGL::getModes(std::vector &modes) GfxMode mode; mode.Width = (uint16)ms[j]->hdisplay; mode.Height = (uint16)ms[j]->vdisplay; - mode.Frequency = 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal); - nldebug("3D: Mode %d: %dx%d, %d Hz", j, ms[j]->hdisplay,ms[j]->vdisplay, 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal)); + const uint16 pixelsCount = ms[j]->htotal * ms[j]->vtotal; + mode.Frequency = pixelCount ? 1000 * ms[j]->dotclock / pixelCount:0; + nldebug("3D: Mode %d: %dx%d, %d Hz", j, mode.Width, mode.Height, mode.Frequency); modes.push_back (mode); } XFree(ms); @@ -1236,7 +1237,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode) mode.Width = (uint16)devmode.dmPelsWidth; mode.Height = (uint16)devmode.dmPelsHeight; mode.AntiAlias = _AntiAliasing; - + #elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) NL3D::MAC::getCurrentScreenMode(mode); @@ -1245,7 +1246,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode) /* TODO this is just a hack to get the ryzom client running on mac os x x11. the implementation below relies on the vidmode extension which is not - availeble on mac os x's x11. for that reason the color depth value is + availeble on mac os x's x11. for that reason the color depth value is hard coded here. FIXME replace this hack by native cocoa color depth retrieval */