diff -Naur Irrlicht.old/CIrrDeviceLinux.cpp Irrlicht/CIrrDeviceLinux.cpp --- Irrlicht.old/CIrrDeviceLinux.cpp 2005-04-20 15:04:27.696211641 +0200 +++ Irrlicht/CIrrDeviceLinux.cpp 2005-04-20 23:25:58.579656196 +0200 @@ -113,20 +113,22 @@ if (!glXMakeCurrent(display, None, NULL)) os::Printer::log("Could not release glx context.", ELL_WARNING); glXDestroyContext(display, context); - context = 0; + context = NULL; } #endif // #ifdef _IRR_COMPILE_WITH_OPENGL_ -#ifdef __IRR_VMODE__ if (fullscreen) { +#ifdef __IRR_VMODE__ XF86VidModeSwitchToMode(display, screennr, &oldVideoMode); XF86VidModeSetViewPort(display, screennr, 0, 0); - } #endif + } +#if 0 if (doublebuffer) XdbeDeallocateBackBufferName(display, bbuffer); +#endif if (shmem) { XShmDetach(display, &shminfo); @@ -179,48 +181,55 @@ // query extension s32 minor, major; + s32 bestMode = -1; + XF86VidModeModeInfo** modes; + if (fullscreen) + { #ifdef __IRR_VMODE__ - if (fullscreen && !XF86VidModeQueryVersion(display, &major, &minor)) + if (!XF86VidModeQueryVersion(display, &major, &minor)) #endif - { - os::Printer::log("VidMode extension must be intalled to let irrlicht " - " be able to switch to fullscreen mode. Running in window mode.", ELL_WARNING); - fullscreen = false; - } - + { + os::Printer::log("VidMode extension must be intalled to let irrlicht " + " be able to switch to fullscreen mode. Running in window mode.", ELL_WARNING); + fullscreen = false; + } #ifdef __IRR_VMODE__ - // enumerate video modes - - s32 modeCount; - XF86VidModeModeInfo** modes; + else + { + // enumerate video modes + s32 modeCount; - XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes); + XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes); - // save current video mode + // save current video mode - oldVideoMode = *modes[0]; + oldVideoMode = *modes[0]; - // find fitting mode + // find fitting mode - bool videoListEmpty = VideoModeList.getVideoModeCount() == 0; + bool videoListEmpty = VideoModeList.getVideoModeCount() == 0; - s32 bestMode = -1; - s32 i = 0; - for (; ihdisplay == width && - modes[i]->vdisplay == height) - { - bestMode = i; - if (videoListEmpty) - VideoModeList.addMode(core::dimension2d( - modes[i]->hdisplay, modes[i]->vdisplay), 0); - } + s32 i = 0; + for (; ihdisplay == width && + modes[i]->vdisplay == height) + { + bestMode = i; + if (videoListEmpty) + VideoModeList.addMode(core::dimension2d( + modes[i]->hdisplay, modes[i]->vdisplay), 0); + } + } + } #endif + } // get visual XVisualInfo* visual = 0; #ifdef _IRR_COMPILE_WITH_OPENGL_ + if (DriverType == video::EDT_OPENGL) { // no double buffer, 4 bits per color, 16 bit zbuffer @@ -287,27 +296,23 @@ } } } + #endif // _IRR_COMPILE_WITH_OPENGL_ - if (!visual) - { - XVisualInfo visTempl; //Template to hold requested values - int visNumber; // Return value of available visuals - visTempl.screen = screennr; - visTempl.depth = 16; - visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, - &visTempl, &visNumber); - if (!visual) - { - visTempl.depth = 32; - visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, - &visTempl, &visNumber); - } if (!visual) { - visTempl.depth = 24; - visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, - &visTempl, &visNumber); + XVisualInfo visTempl; //Template to hold requested values + int visNumber; // Return value of available visuals + + visTempl.screen = screennr; + visTempl.depth = 16; + while ((!visual) && (visTempl.depth<=32)) + { + visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, + &visTempl, &visNumber); + visTempl.depth +=8; + } + } #if 0 if (XdbeQueryExtension(display, &major, &minor)) @@ -323,8 +328,7 @@ XdbeFreeVisualInfo(DBEVisuals); } #endif - } - + if (!visual) { os::Printer::log("Fatal error, could not get visual.", ELL_ERROR); @@ -335,6 +339,8 @@ #ifdef _IRR_COMPILE_WITH_OPENGL_ + if (DriverType == video::EDT_OPENGL) + { // create glx context glXQueryVersion(display, &major, &minor); @@ -345,6 +351,7 @@ XFree(visual); return false; } + } #endif // _IRR_COMPILE_WITH_OPENGL_ @@ -360,7 +367,8 @@ RootWindow(display, visual->screen), visual->visual, AllocNone); attributes.colormap = colormap; - } else + } + else { attributes.colormap = bestMapInfo->colormap; } @@ -449,14 +457,19 @@ #endif #ifdef _IRR_COMPILE_WITH_OPENGL_ + if (DriverType == video::EDT_OPENGL) +{ // connect glx context to window //os::Printer::log("Connecting glx context to window...", ELL_INFORMATION); glXMakeCurrent(display, window, context); -#else +} +#endif // _IRR_COMPILE_WITH_OPENGL_ + +#if 0 if (doublebuffer) bbuffer=XdbeAllocateBackBufferName(display, window, XdbeUndefined); -#endif // _IRR_COMPILE_WITH_OPENGL_ +#endif Window tmp; u32 tmp2; @@ -794,12 +807,14 @@ GC gc = DefaultGC(display, DefaultScreen(display)); if (doublebuffer) { +#if 0 XdbeSwapInfo swapInfo; swapInfo.swap_window=window; swapInfo.swap_action=XdbeUndefined; XPutImage(display, bbuffer, gc, SoftwareImage, 0, 0, 0, 0, destwidth, destheight); XdbeSwapBuffers(display, &swapInfo, 1); +#endif } else if (shmem) XShmPutImage(display, window, gc, SoftwareImage, 0, 0, 0, 0, destwidth, destheight, false); else