- Fixed bugs related to OpenGL ES 1.x and 2.x in Linux and Win32 devices.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4246 dfc29bdd-3216-0410-991c-e03cc46cb475
master
nadro 2012-07-14 12:42:09 +00:00
parent 5d8cb2efce
commit 902ef62234
3 changed files with 114 additions and 8 deletions

View File

@ -18,6 +18,7 @@
#include "COSOperator.h"
#include "CColorConverter.h"
#include "SIrrCreationParameters.h"
#include "SExposedVideoData.h"
#include "IGUISpriteBank.h"
#include <X11/XKBlib.h>
#include <X11/Xatom.h>
@ -50,8 +51,18 @@ namespace irr
{
namespace video
{
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceLinux* device);
#ifdef _IRR_COMPILE_WITH_OPENGL_
IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceWin32* device);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io);
#endif
}
} // end namespace irr
@ -810,6 +821,32 @@ void CIrrDeviceLinux::createDriver()
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
VideoDriver = video::createOGLES1Driver(CreationParams, data, FileSystem);
}
#else
os::Printer::log("No OpenGL-ES1 support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:
#ifdef _IRR_COMPILE_WITH_OGLES2_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
}
#else
os::Printer::log("No OpenGL-ES2 support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_DIRECT3D8:
case video::EDT_DIRECT3D9:

View File

@ -17,6 +17,7 @@
#include "dimension2d.h"
#include "IGUISpriteBank.h"
#include <winuser.h>
#include "SExposedVideoData.h"
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
#ifdef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#define DIRECTINPUT_VERSION 0x0800
@ -50,6 +51,14 @@ namespace irr
IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params,
io::IFileSystem* io, CIrrDeviceWin32* device);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io);
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io);
#endif
}
} // end namespace irr
@ -899,8 +908,8 @@ namespace irr
//! constructor
CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false), Resized(false),
ExternalWindow(false), Win32CursorControl(0), JoyControl(0)
: CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false), IsNonNTWindows(false),
Resized(false), ExternalWindow(false), Win32CursorControl(0), JoyControl(0)
{
#ifdef _DEBUG
setDebugName("CIrrDeviceWin32");
@ -1107,6 +1116,44 @@ void CIrrDeviceWin32::createDriver()
os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
{
video::SExposedVideoData data;
data.OpenGLWin32.HWnd=HWnd;
switchToFullScreen();
VideoDriver = video::createOGLES1Driver(CreationParams, data, FileSystem);
if (!VideoDriver)
{
os::Printer::log("Could not create OpenGL-ES1 driver.", ELL_ERROR);
}
}
#else
os::Printer::log("OpenGL-ES1 driver was not compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:
#ifdef _IRR_COMPILE_WITH_OGLES2_
{
video::SExposedVideoData data;
data.OpenGLWin32.HWnd=HWnd;
switchToFullScreen();
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
if (!VideoDriver)
{
os::Printer::log("Could not create OpenGL-ES2 driver.", ELL_ERROR);
}
}
#else
os::Printer::log("OpenGL-ES2 driver was not compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_SOFTWARE:
@ -1229,10 +1276,27 @@ void CIrrDeviceWin32::setWindowCaption(const wchar_t* text)
{
// We use SendMessage instead of SetText to ensure proper
// function even in cases where the HWND was created in a different thread
DWORD_PTR dwResult;
SendMessageTimeoutW(HWnd, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(text),
SMTO_ABORTIFHUNG, 2000, &dwResult);
DWORD dwResult;
if (IsNonNTWindows)
{
const core::stringc s = text;
#if defined(_WIN64) || defined(WIN64)
SetWindowTextA(HWnd, s.c_str());
#else
SendMessageTimeout(HWnd, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(s.c_str()),
SMTO_ABORTIFHUNG, 2000, &dwResult);
#endif
}
else
{
#if defined(_WIN64) || defined(WIN64)
SetWindowTextW(HWnd, text);
#else
SendMessageTimeoutW(HWnd, WM_SETTEXT, 0,
reinterpret_cast<LPARAM>(text),
SMTO_ABORTIFHUNG, 2000, &dwResult);
#endif
}
@ -1622,6 +1686,8 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
break;
case VER_PLATFORM_WIN32_WINDOWS:
IsNonNTWindows = true;
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
@ -1643,6 +1709,8 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
break;
case VER_PLATFORM_WIN32s:
IsNonNTWindows = true;
out.append("Microsoft Win32s ");
break;
}

View File

@ -389,6 +389,7 @@ namespace irr
HWND HWnd;
bool ChangedToFullScreen;
bool IsNonNTWindows;
bool Resized;
bool ExternalWindow;
CCursorControl* Win32CursorControl;