[android] backport the Irrlicht.cpp createDevice changes, fix the compile error, and use OGLES2 on android
This commit is contained in:
parent
d2b5d5ad05
commit
e39efc128c
@ -4,7 +4,7 @@
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
static const char* const copyright = "Irrlicht Engine (c) 2002-2012 Nikolaus Gebhardt";
|
||||
//static const char* const copyright = "Irrlicht Engine (c) 2002-2012 Nikolaus Gebhardt";
|
||||
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#include <windows.h>
|
||||
@ -30,10 +30,6 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2012 Nikolaus Geb
|
||||
#include "CIrrDeviceLinux.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_IPHONE_DEVICE_
|
||||
#include "iOS/CIrrDeviceiOS.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#include "CIrrDeviceSDL.h"
|
||||
#endif
|
||||
@ -57,7 +53,8 @@ namespace irr
|
||||
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(video::E_DRIVER_TYPE driverType,
|
||||
const core::dimension2d<u32>& windowSize,
|
||||
u32 bits, bool fullscreen,
|
||||
bool stencilbuffer, bool vsync, IEventReceiver* res)
|
||||
bool stencilbuffer, bool vsync, IEventReceiver* res,
|
||||
io::IFileSystem *file_system)
|
||||
{
|
||||
SIrrlichtCreationParameters p;
|
||||
p.DriverType = driverType;
|
||||
@ -67,6 +64,7 @@ namespace irr
|
||||
p.Stencilbuffer = stencilbuffer;
|
||||
p.Vsync = vsync;
|
||||
p.EventReceiver = res;
|
||||
p.FileSystem = file_system;
|
||||
|
||||
return createDeviceEx(p);
|
||||
}
|
||||
@ -95,11 +93,6 @@ namespace irr
|
||||
if (params.DeviceType == EIDT_X11 || (!dev && params.DeviceType == EIDT_BEST))
|
||||
dev = new CIrrDeviceLinux(params);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_IPHONE_DEVICE_
|
||||
if (params.DeviceType == EIDT_IPHONE || (!dev && params.DeviceType == EIDT_BEST))
|
||||
dev = new CIrrDeviceIPhone(params);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
if (params.DeviceType == EIDT_SDL || (!dev && params.DeviceType == EIDT_BEST))
|
||||
@ -111,17 +104,17 @@ namespace irr
|
||||
dev = new CIrrDeviceFB(params);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
if (params.DeviceType == EIDT_ANDROID || (!dev && params.DeviceType == EIDT_BEST)) {
|
||||
dev = new CIrrDeviceAndroid(params);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
if (params.DeviceType == EIDT_CONSOLE || (!dev && params.DeviceType == EIDT_BEST))
|
||||
dev = new CIrrDeviceConsole(params);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
if (params.DeviceType == EIDT_ANDROID || (!dev && params.DeviceType == EIDT_BEST)) {
|
||||
dev = new CIrrDeviceAndroid(params);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dev && !dev->getVideoDriver() && params.DriverType != video::EDT_NULL)
|
||||
{
|
||||
dev->closeDevice(); // destroy window
|
||||
@ -147,7 +140,7 @@ namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#if defined(_IRR_WINDOWS_API_)
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined(_IRR_STATIC_LIB_)
|
||||
|
||||
BOOL APIENTRY DllMain( HANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
|
@ -113,7 +113,7 @@ IrrDriver::IrrDriver()
|
||||
m_shadow_matrices = NULL;
|
||||
m_resolution_changing = RES_CHANGE_NONE;
|
||||
m_phase = SOLID_NORMAL_AND_DEPTH_PASS;
|
||||
m_device = createDevice(video::EDT_NULL,
|
||||
m_device = irr::createDevice(video::EDT_NULL,
|
||||
irr::core::dimension2d<u32>(640, 480),
|
||||
/*bits*/16U, /**fullscreen*/ false,
|
||||
/*stencilBuffer*/ false,
|
||||
@ -440,7 +440,11 @@ void IrrDriver::initDevice()
|
||||
Log::verbose("irr_driver", "Trying to create device with "
|
||||
"%i bits\n", bits);
|
||||
|
||||
#ifdef ANDROID_DEVICE
|
||||
params.DriverType = video::EDT_OPENGL;
|
||||
#else
|
||||
params.DriverType = video::EDT_OGLES2;
|
||||
#endif
|
||||
params.Stencilbuffer = false;
|
||||
params.Bits = bits;
|
||||
params.EventReceiver = this;
|
||||
@ -473,7 +477,7 @@ void IrrDriver::initDevice()
|
||||
(int)UserConfigParams::m_antialiasing);
|
||||
}
|
||||
*/
|
||||
m_device = createDeviceEx(params);
|
||||
m_device = irr::createDeviceEx(params);
|
||||
|
||||
if(m_device)
|
||||
break;
|
||||
@ -487,7 +491,11 @@ void IrrDriver::initDevice()
|
||||
UserConfigParams::m_width = MIN_SUPPORTED_WIDTH;
|
||||
UserConfigParams::m_height = MIN_SUPPORTED_HEIGHT;
|
||||
|
||||
#ifdef ANDROID_DEVICE
|
||||
m_device = createDevice(video::EDT_OPENGL,
|
||||
#else
|
||||
m_device = createDevice(video::EDT_OGLES2,
|
||||
#endif
|
||||
core::dimension2du(UserConfigParams::m_width,
|
||||
UserConfigParams::m_height ),
|
||||
32, //bits per pixel
|
||||
|
Loading…
Reference in New Issue
Block a user