diff --git a/include/IVideoDriver.h b/include/IVideoDriver.h index 9cdb4d6f..77d01270 100644 --- a/include/IVideoDriver.h +++ b/include/IVideoDriver.h @@ -77,9 +77,6 @@ namespace video { public: - //! Destructor - virtual ~IVideoDriver() {} - //! Applications must call this method before performing any rendering. /** This method can clear the back- and the z-buffer. \param backBuffer Specifies if the back buffer should be @@ -639,7 +636,11 @@ namespace video f32 density=0.01f, bool pixelFog=false, bool rangeFog=false) = 0; - //! Returns the size of the screen or render window. + //! Get the current color format of the color buffer + /** \return Color format of the color buffer. */ + virtual ECOLOR_FORMAT getColorFormat() const = 0; + + //! Get the size of the screen or render window. /** \return Size of screen or render window. */ virtual const core::dimension2d& getScreenSize() const = 0; diff --git a/include/IrrlichtDevice.h b/include/IrrlichtDevice.h index b26c514a..d19e360b 100644 --- a/include/IrrlichtDevice.h +++ b/include/IrrlichtDevice.h @@ -163,6 +163,10 @@ namespace irr /** \return True if window is fullscreen. */ virtual bool isFullscreen() const = 0; + //! Get the current color format of the window + /** \return Color format of the window. */ + virtual video::ECOLOR_FORMAT getColorFormat() const = 0; + //! Notifies the device that it should close itself. /** IrrlichtDevice::run() will always return false after closeDevice() was called. */ virtual void closeDevice() = 0; diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index d18cfac6..eaeb3314 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/source/Irrlicht/CIrrDeviceLinux.cpp @@ -452,12 +452,12 @@ bool CIrrDeviceLinux::createWindow() int visNumber; // Return value of available visuals visTempl.screen = screennr; - visTempl.depth = 16; - while ((!visual) && (visTempl.depth<=32)) + visTempl.depth = 32; + while ((!visual) && (visTempl.depth>=16)) { visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, &visTempl, &visNumber); - visTempl.depth+=8; + visTempl.depth-=8; } } @@ -1028,6 +1028,16 @@ bool CIrrDeviceLinux::isWindowMinimized() const } +//! returns color format of the window. +video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const +{ + if (visual && (visual->depth != 16)) + return video::ECF_R8G8B8; + else + return video::ECF_R5G6B5; +} + + //! Sets if the window should be resizeable in windowed mode. void CIrrDeviceLinux::setResizeAble(bool resize) { diff --git a/source/Irrlicht/CIrrDeviceLinux.h b/source/Irrlicht/CIrrDeviceLinux.h index f64389bc..69149045 100644 --- a/source/Irrlicht/CIrrDeviceLinux.h +++ b/source/Irrlicht/CIrrDeviceLinux.h @@ -74,6 +74,9 @@ namespace irr //! returns if window is minimized. virtual bool isWindowMinimized() const; + //! returns color format of the window. + virtual video::ECOLOR_FORMAT getColorFormat() const; + //! presents a surface in the client area virtual void present(video::IImage* surface, void* windowId=0, core::rect* src=0 ); diff --git a/source/Irrlicht/CIrrDeviceStub.cpp b/source/Irrlicht/CIrrDeviceStub.cpp index f8c65561..0d297164 100644 --- a/source/Irrlicht/CIrrDeviceStub.cpp +++ b/source/Irrlicht/CIrrDeviceStub.cpp @@ -241,5 +241,12 @@ bool CIrrDeviceStub::isFullscreen() const } +//! returns color format +video::ECOLOR_FORMAT CIrrDeviceStub::getColorFormat() const +{ + return video::ECF_R5G6B5; +} + + } // end namespace irr diff --git a/source/Irrlicht/CIrrDeviceStub.h b/source/Irrlicht/CIrrDeviceStub.h index 7d37bfc5..18deff25 100644 --- a/source/Irrlicht/CIrrDeviceStub.h +++ b/source/Irrlicht/CIrrDeviceStub.h @@ -104,6 +104,9 @@ namespace irr //! Checks if the window is running in fullscreen mode. virtual bool isFullscreen() const; + //! get color format of the current window + virtual video::ECOLOR_FORMAT getColorFormat() const; + protected: void createGUIAndScene(); diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index 7d07c3f1..0d1a70b5 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -707,6 +707,11 @@ void CNullDriver::draw2DPolygon(core::position2d center, } +//! returns color format +ECOLOR_FORMAT CNullDriver::getColorFormat() const +{ + return ECF_R5G6B5; +} //! returns screen size @@ -715,6 +720,7 @@ const core::dimension2d& CNullDriver::getScreenSize() const return ScreenSize; } + //! returns the current render target size, //! or the screen size if render targets are not implemented const core::dimension2d& CNullDriver::getCurrentRenderTargetSize() const diff --git a/source/Irrlicht/CNullDriver.h b/source/Irrlicht/CNullDriver.h index eb4eb2f4..bcd8dabe 100644 --- a/source/Irrlicht/CNullDriver.h +++ b/source/Irrlicht/CNullDriver.h @@ -183,13 +183,16 @@ namespace video f32 start=50.0f, f32 end=100.0f, f32 density=0.01f, bool pixelFog=false, bool rangeFog=false); - //! returns screen size + //! get color format of the current color buffer + virtual ECOLOR_FORMAT getColorFormat() const; + + //! get screen size virtual const core::dimension2d& getScreenSize() const; - //! returns screen size + //! get render target size virtual const core::dimension2d& getCurrentRenderTargetSize() const; - // returns current frames per second value + // get current frames per second value virtual s32 getFPS() const; //! returns amount of primitives (mostly triangles) were drawn in the last frame.