- Exclude EGL code from OpenGL ES driver files. This is first step for improve Android device support.
WARNING: This commit is pushed out only for development reason. It may break temporary devices other than Android. Android device improve process will be completed in next 1-3 commits. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4588 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
fe5cb8d200
commit
5987dfc654
|
@ -92,6 +92,13 @@ struct SExposedVideoData
|
||||||
void* View;
|
void* View;
|
||||||
|
|
||||||
} OGLESIPhone;
|
} OGLESIPhone;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
//! The ANativeWindow object.
|
||||||
|
void* window;
|
||||||
|
|
||||||
|
} OGLESAndroid;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "CFileSystem.h"
|
#include "CFileSystem.h"
|
||||||
#include "CAndroidAssetFileArchive.h"
|
#include "CAndroidAssetFileArchive.h"
|
||||||
|
#include "CEGLManager.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||||
video::SExposedVideoData& data, io::IFileSystem* io);
|
video::SExposedVideoData& data, io::IFileSystem* io, video::CEGLManager* eglManager);
|
||||||
|
|
||||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||||
video::SExposedVideoData& data, io::IFileSystem* io);
|
video::SExposedVideoData& data, io::IFileSystem* io);
|
||||||
|
@ -97,6 +98,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
||||||
FileSystem->addFileArchive(assets);
|
FileSystem->addFileArchive(assets);
|
||||||
|
|
||||||
// Create the driver.
|
// Create the driver.
|
||||||
|
getEGLManager()->createContext();
|
||||||
createDriver();
|
createDriver();
|
||||||
|
|
||||||
if (VideoDriver)
|
if (VideoDriver)
|
||||||
|
@ -117,18 +119,19 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
||||||
|
|
||||||
CIrrDeviceAndroid::~CIrrDeviceAndroid(void)
|
CIrrDeviceAndroid::~CIrrDeviceAndroid(void)
|
||||||
{
|
{
|
||||||
|
delete EGLManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIrrDeviceAndroid::createDriver( void )
|
void CIrrDeviceAndroid::createDriver( void )
|
||||||
{
|
{
|
||||||
video::SExposedVideoData data;
|
|
||||||
|
|
||||||
// Create the driver.
|
// Create the driver.
|
||||||
switch(CreationParams.DriverType)
|
switch(CreationParams.DriverType)
|
||||||
{
|
{
|
||||||
case video::EDT_OGLES1:
|
case video::EDT_OGLES1:
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||||
VideoDriver = video::createOGLES1Driver(CreationParams, data, FileSystem);
|
VideoDriver = video::createOGLES1Driver(CreationParams, ExposedVideoData, FileSystem, EGLManager);
|
||||||
#else
|
#else
|
||||||
os::Printer::log("No OpenGL ES 1.0 support compiled in.", ELL_ERROR);
|
os::Printer::log("No OpenGL ES 1.0 support compiled in.", ELL_ERROR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -136,7 +139,7 @@ void CIrrDeviceAndroid::createDriver( void )
|
||||||
|
|
||||||
case video::EDT_OGLES2:
|
case video::EDT_OGLES2:
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||||
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
|
VideoDriver = video::createOGLES2Driver(CreationParams, ExposedVideoData, FileSystem);
|
||||||
#else
|
#else
|
||||||
os::Printer::log("No OpenGL ES 2.0 support compiled in.", ELL_ERROR);
|
os::Printer::log("No OpenGL ES 2.0 support compiled in.", ELL_ERROR);
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,17 +224,17 @@ bool CIrrDeviceAndroid::present(video::IImage* surface, void* windowId, core::re
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowActive( void ) const
|
bool CIrrDeviceAndroid::isWindowActive( void ) const
|
||||||
{
|
{
|
||||||
return( true );
|
return Animating;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowFocused( void ) const
|
bool CIrrDeviceAndroid::isWindowFocused( void ) const
|
||||||
{
|
{
|
||||||
return( false );
|
return Animating;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowMinimized( void ) const
|
bool CIrrDeviceAndroid::isWindowMinimized( void ) const
|
||||||
{
|
{
|
||||||
return( false );
|
return !Animating;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIrrDeviceAndroid::closeDevice( void )
|
void CIrrDeviceAndroid::closeDevice( void )
|
||||||
|
@ -290,10 +293,15 @@ void CIrrDeviceAndroid::handleAndroidCommand( struct android_app* app, s32 cmd )
|
||||||
break;
|
break;
|
||||||
case APP_CMD_INIT_WINDOW:
|
case APP_CMD_INIT_WINDOW:
|
||||||
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
|
||||||
|
deviceAndroid->getExposedVideoData().OGLESAndroid.window = Android->window;
|
||||||
|
deviceAndroid->getEGLManager()->createEGL();
|
||||||
deviceAndroid->IsReady = true;
|
deviceAndroid->IsReady = true;
|
||||||
|
deviceAndroid->Animating = true;
|
||||||
break;
|
break;
|
||||||
case APP_CMD_TERM_WINDOW:
|
case APP_CMD_TERM_WINDOW:
|
||||||
os::Printer::log("Android command APP_CMD_TERM_WINDOW", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_TERM_WINDOW", ELL_DEBUG);
|
||||||
|
deviceAndroid->getEGLManager()->destroyEGL();
|
||||||
|
deviceAndroid->Animating = false;
|
||||||
break;
|
break;
|
||||||
case APP_CMD_GAINED_FOCUS:
|
case APP_CMD_GAINED_FOCUS:
|
||||||
os::Printer::log("Android command APP_CMD_GAINED_FOCUS", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_GAINED_FOCUS", ELL_DEBUG);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
#include "IImagePresenter.h"
|
||||||
#include "ICursorControl.h"
|
#include "ICursorControl.h"
|
||||||
|
#include "CEGLManager.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
@ -140,6 +141,19 @@ namespace irr
|
||||||
};
|
};
|
||||||
|
|
||||||
static android_app *getAndroidApp() { return Android; }
|
static android_app *getAndroidApp() { return Android; }
|
||||||
|
|
||||||
|
video::SExposedVideoData& getExposedVideoData()
|
||||||
|
{
|
||||||
|
return ExposedVideoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
video::CEGLManager* getEGLManager()
|
||||||
|
{
|
||||||
|
if (!EGLManager)
|
||||||
|
EGLManager = new video::CEGLManager(CreationParams, ExposedVideoData);
|
||||||
|
|
||||||
|
return EGLManager;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static android_app *Android;
|
static android_app *Android;
|
||||||
|
@ -153,6 +167,9 @@ namespace irr
|
||||||
void createDriver( void );
|
void createDriver( void );
|
||||||
static void handleAndroidCommand( struct android_app* app, s32 cmd );
|
static void handleAndroidCommand( struct android_app* app, s32 cmd );
|
||||||
static s32 handleInput( struct android_app* app, AInputEvent* event );
|
static s32 handleInput( struct android_app* app, AInputEvent* event );
|
||||||
|
|
||||||
|
video::SExposedVideoData ExposedVideoData;
|
||||||
|
video::CEGLManager* EGLManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
|
@ -146,6 +146,7 @@ LOCAL_SRC_FILES := \
|
||||||
COCTLoader.cpp \
|
COCTLoader.cpp \
|
||||||
COctreeSceneNode.cpp \
|
COctreeSceneNode.cpp \
|
||||||
COctreeTriangleSelector.cpp \
|
COctreeTriangleSelector.cpp \
|
||||||
|
CEGLManager.cpp \
|
||||||
COGLES2Driver.cpp \
|
COGLES2Driver.cpp \
|
||||||
COGLES2ExtensionHandler.cpp \
|
COGLES2ExtensionHandler.cpp \
|
||||||
COGLES2MaterialRenderer.cpp \
|
COGLES2MaterialRenderer.cpp \
|
||||||
|
|
|
@ -0,0 +1,340 @@
|
||||||
|
// Copyright (C) 2013 Patryk Nadrowski
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#include "CEGLManager.h"
|
||||||
|
|
||||||
|
#include "irrString.h"
|
||||||
|
#include "os.h"
|
||||||
|
|
||||||
|
namespace irr
|
||||||
|
{
|
||||||
|
namespace video
|
||||||
|
{
|
||||||
|
|
||||||
|
CEGLManager::CEGLManager(const SIrrlichtCreationParameters& params, SExposedVideoData& data) :
|
||||||
|
EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), EglReady(false), Params(params), Data(data)
|
||||||
|
{
|
||||||
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
|
EglWindow = (NativeWindowType)data.OpenGLWin32.HWnd;
|
||||||
|
HDc = GetDC((HWND)EglWindow);
|
||||||
|
EglDisplay = eglGetDisplay((NativeDisplayType)HDc);
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||||
|
EglWindow = (NativeWindowType)ExposedData.OpenGLLinux.X11Window;
|
||||||
|
EglDisplay = eglGetDisplay((NativeDisplayType)ExposedData.OpenGLLinux.X11Display);
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
|
EglWindow = (ANativeWindow*)data.OGLESAndroid.window;
|
||||||
|
EglDisplay = eglGetDisplay((NativeDisplayType) EGL_DEFAULT_DISPLAY);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (EglDisplay == EGL_NO_DISPLAY)
|
||||||
|
os::Printer::log("Could not get EGL display.");
|
||||||
|
}
|
||||||
|
|
||||||
|
CEGLManager::~CEGLManager()
|
||||||
|
{
|
||||||
|
destroyContext();
|
||||||
|
destroyEGL();
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
|
if (HDc)
|
||||||
|
ReleaseDC((HWND)EglWindow, HDc);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEGLManager::createEGL()
|
||||||
|
{
|
||||||
|
if (EglDisplay == EGL_NO_DISPLAY)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (EglReady)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
EGLint MajorVersion = 0, MinorVersion = 0;
|
||||||
|
|
||||||
|
if (!eglInitialize(EglDisplay, &MajorVersion, &MinorVersion))
|
||||||
|
os::Printer::log("Could not initialize EGL display.");
|
||||||
|
else
|
||||||
|
os::Printer::log("EGL version", core::stringc(MajorVersion+(MinorVersion*0.1f)).c_str());
|
||||||
|
|
||||||
|
EGLint Attribs[] =
|
||||||
|
{
|
||||||
|
#if defined( _IRR_COMPILE_WITH_ANDROID_DEVICE_ )
|
||||||
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
|
EGL_BLUE_SIZE, 8,
|
||||||
|
EGL_GREEN_SIZE, 8,
|
||||||
|
EGL_RED_SIZE, 8,
|
||||||
|
EGL_DEPTH_SIZE, Params.ZBufferBits,
|
||||||
|
EGL_NONE
|
||||||
|
#else
|
||||||
|
EGL_RED_SIZE, 8,
|
||||||
|
EGL_GREEN_SIZE, 8,
|
||||||
|
EGL_BLUE_SIZE, 8,
|
||||||
|
EGL_ALPHA_SIZE, params.WithAlphaChannel ? 1:0,
|
||||||
|
EGL_BUFFER_SIZE, params.Bits,
|
||||||
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
|
EGL_DEPTH_SIZE, params.ZBufferBits,
|
||||||
|
EGL_STENCIL_SIZE, params.Stencilbuffer,
|
||||||
|
EGL_SAMPLE_BUFFERS, params.AntiAlias ? 1:0,
|
||||||
|
EGL_SAMPLES, params.AntiAlias,
|
||||||
|
#ifdef EGL_VERSION_1_3
|
||||||
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
||||||
|
#endif
|
||||||
|
EGL_NONE, 0
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
EglConfig = 0;
|
||||||
|
EGLint NumConfigs = 0;
|
||||||
|
u32 Steps = 5;
|
||||||
|
|
||||||
|
while (!eglChooseConfig(EglDisplay, Attribs, &EglConfig, 1, &NumConfigs) || !NumConfigs)
|
||||||
|
{
|
||||||
|
switch (Steps)
|
||||||
|
{
|
||||||
|
case 5: // samples
|
||||||
|
if (Attribs[19] > 2)
|
||||||
|
--Attribs[19];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Attribs[17] = 0;
|
||||||
|
Attribs[19] = 0;
|
||||||
|
--Steps;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4: // alpha
|
||||||
|
if (Attribs[7])
|
||||||
|
{
|
||||||
|
Attribs[7] = 0;
|
||||||
|
|
||||||
|
if (Params.AntiAlias)
|
||||||
|
{
|
||||||
|
Attribs[17] = 1;
|
||||||
|
Attribs[19] = Params.AntiAlias;
|
||||||
|
Steps = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--Steps;
|
||||||
|
break;
|
||||||
|
case 3: // stencil
|
||||||
|
if (Attribs[15])
|
||||||
|
{
|
||||||
|
Attribs[15] = 0;
|
||||||
|
|
||||||
|
if (Params.AntiAlias)
|
||||||
|
{
|
||||||
|
Attribs[17] = 1;
|
||||||
|
Attribs[19] = Params.AntiAlias;
|
||||||
|
Steps = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--Steps;
|
||||||
|
break;
|
||||||
|
case 2: // depth size
|
||||||
|
if (Attribs[13] > 16)
|
||||||
|
{
|
||||||
|
Attribs[13] -= 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--Steps;
|
||||||
|
break;
|
||||||
|
case 1: // buffer size
|
||||||
|
if (Attribs[9] > 16)
|
||||||
|
{
|
||||||
|
Attribs[9] -= 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--Steps;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
os::Printer::log("Could not get config for EGL display.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Params.AntiAlias && !Attribs[17])
|
||||||
|
os::Printer::log("No multisampling.");
|
||||||
|
|
||||||
|
if (Params.WithAlphaChannel && !Attribs[7])
|
||||||
|
os::Printer::log("No alpha.");
|
||||||
|
|
||||||
|
if (Params.Stencilbuffer && !Attribs[15])
|
||||||
|
os::Printer::log("No stencil buffer.");
|
||||||
|
|
||||||
|
if (Params.ZBufferBits > Attribs[13])
|
||||||
|
os::Printer::log("No full depth buffer.");
|
||||||
|
|
||||||
|
if (Params.Bits > Attribs[9])
|
||||||
|
os::Printer::log("No full color buffer.");
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
|
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
|
||||||
|
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
|
||||||
|
* As soon as we picked a EGLConfig, we can safely reconfigure the
|
||||||
|
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
|
||||||
|
EGLint Format = 0;
|
||||||
|
eglGetConfigAttrib(EglDisplay, EglConfig, EGL_NATIVE_VISUAL_ID, &Format);
|
||||||
|
|
||||||
|
ANativeWindow_setBuffersGeometry(EglWindow, 0, 0, Format);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, EglWindow, 0);
|
||||||
|
|
||||||
|
if (EGL_NO_SURFACE == EglSurface)
|
||||||
|
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, 0, 0);
|
||||||
|
|
||||||
|
if (EGL_NO_SURFACE == EglSurface)
|
||||||
|
{
|
||||||
|
os::Printer::log("Could not create EGL surface.");
|
||||||
|
eglTerminate(EglDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef EGL_VERSION_1_2
|
||||||
|
if (MinorVersion > 1)
|
||||||
|
eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (Params.Vsync)
|
||||||
|
eglSwapInterval(EglDisplay, 1);
|
||||||
|
|
||||||
|
if (EglContext != EGL_NO_CONTEXT)
|
||||||
|
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||||
|
|
||||||
|
EglReady = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEGLManager::destroyEGL()
|
||||||
|
{
|
||||||
|
if (!EglReady)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
eglDestroySurface(EglDisplay, EglSurface);
|
||||||
|
eglTerminate(EglDisplay);
|
||||||
|
|
||||||
|
EglSurface = EGL_NO_SURFACE;
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
|
if (HDc)
|
||||||
|
ReleaseDC((HWND)EglWindow, HDc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EglReady = false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEGLManager::createContext()
|
||||||
|
{
|
||||||
|
if (EglDisplay == EGL_NO_DISPLAY || !EglReady)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (EglContext != EGL_NO_CONTEXT)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
EGLint ContextAttrib[] =
|
||||||
|
{
|
||||||
|
#ifdef EGL_VERSION_1_3
|
||||||
|
EGL_CONTEXT_CLIENT_VERSION, 1,
|
||||||
|
#endif
|
||||||
|
EGL_NONE, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
EglContext = eglCreateContext(EglDisplay, EglConfig, EGL_NO_CONTEXT, ContextAttrib);
|
||||||
|
|
||||||
|
if (testEGLError())
|
||||||
|
os::Printer::log("Could not create EGL context.");
|
||||||
|
|
||||||
|
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||||
|
|
||||||
|
if (testEGLError())
|
||||||
|
os::Printer::log("Could not make EGL context current.");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEGLManager::destroyContext()
|
||||||
|
{
|
||||||
|
if (EglContext == EGL_NO_CONTEXT)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroyContext(EglDisplay, EglContext);
|
||||||
|
|
||||||
|
EglContext = EGL_NO_CONTEXT;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEGLManager::swapBuffers()
|
||||||
|
{
|
||||||
|
eglSwapBuffers(EglDisplay, EglSurface);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEGLManager::testEGLError()
|
||||||
|
{
|
||||||
|
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
||||||
|
EGLint Status = eglGetError();
|
||||||
|
|
||||||
|
switch (Status)
|
||||||
|
{
|
||||||
|
case EGL_SUCCESS:
|
||||||
|
return false;
|
||||||
|
case EGL_NOT_INITIALIZED :
|
||||||
|
os::Printer::log("Not Initialized", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_ACCESS:
|
||||||
|
os::Printer::log("Bad Access", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_ALLOC:
|
||||||
|
os::Printer::log("Bad Alloc", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_ATTRIBUTE:
|
||||||
|
os::Printer::log("Bad Attribute", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_CONTEXT:
|
||||||
|
os::Printer::log("Bad Context", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_CONFIG:
|
||||||
|
os::Printer::log("Bad Config", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_CURRENT_SURFACE:
|
||||||
|
os::Printer::log("Bad Current Surface", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_DISPLAY:
|
||||||
|
os::Printer::log("Bad Display", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_SURFACE:
|
||||||
|
os::Printer::log("Bad Surface", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_MATCH:
|
||||||
|
os::Printer::log("Bad Match", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_PARAMETER:
|
||||||
|
os::Printer::log("Bad Parameter", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_NATIVE_PIXMAP:
|
||||||
|
os::Printer::log("Bad Native Pixmap", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_BAD_NATIVE_WINDOW:
|
||||||
|
os::Printer::log("Bad Native Window", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
case EGL_CONTEXT_LOST:
|
||||||
|
os::Printer::log("Context Lost", ELL_ERROR);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
// Copyright (C) 2013 Patryk Nadrowski
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#ifndef __C_EGL_MANAGER_H_INCLUDED__
|
||||||
|
#define __C_EGL_MANAGER_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "IrrCompileConfig.h"
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#else
|
||||||
|
#include <GLES/egl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "SIrrCreationParameters.h"
|
||||||
|
#include "SExposedVideoData.h"
|
||||||
|
|
||||||
|
namespace irr
|
||||||
|
{
|
||||||
|
namespace video
|
||||||
|
{
|
||||||
|
// EGL manager.
|
||||||
|
class CEGLManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor.
|
||||||
|
CEGLManager(const SIrrlichtCreationParameters& params, SExposedVideoData& data);
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
~CEGLManager();
|
||||||
|
|
||||||
|
// Create window, display and surface.
|
||||||
|
bool createEGL();
|
||||||
|
|
||||||
|
// Destroy window, display and surface.
|
||||||
|
bool destroyEGL();
|
||||||
|
|
||||||
|
// Create EGL context.
|
||||||
|
bool createContext();
|
||||||
|
|
||||||
|
// Destroy EGL context.
|
||||||
|
bool destroyContext();
|
||||||
|
|
||||||
|
// Swap buffers.
|
||||||
|
void swapBuffers();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool testEGLError();
|
||||||
|
|
||||||
|
NativeWindowType EglWindow;
|
||||||
|
EGLDisplay EglDisplay;
|
||||||
|
EGLSurface EglSurface;
|
||||||
|
EGLContext EglContext;
|
||||||
|
|
||||||
|
EGLConfig EglConfig;
|
||||||
|
|
||||||
|
bool EglReady;
|
||||||
|
|
||||||
|
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||||
|
HDC HDc;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SIrrlichtCreationParameters Params;
|
||||||
|
SExposedVideoData Data;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||||
|
|
||||||
#include "COGLESDriver.h"
|
#include "COGLESDriver.h"
|
||||||
// needed here also because of the create methods' parameters
|
|
||||||
#include "CNullDriver.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||||
|
|
||||||
|
#include "CNullDriver.h"
|
||||||
#include "COGLESTexture.h"
|
#include "COGLESTexture.h"
|
||||||
#include "COGLESMaterialRenderer.h"
|
#include "COGLESMaterialRenderer.h"
|
||||||
#include "CImage.h"
|
#include "CImage.h"
|
||||||
|
@ -22,223 +21,43 @@ namespace irr
|
||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
//! constructor and init code
|
|
||||||
COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||||
const SExposedVideoData& data, io::IFileSystem* io
|
const SExposedVideoData& data, io::IFileSystem* io
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
, CIrrDeviceIPhone* device
|
, CEGLManager* eglManager
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
|
, CIrrDeviceIPhone* device
|
||||||
#endif
|
#endif
|
||||||
)
|
) : CNullDriver(io, params.WindowSize), COGLES1ExtensionHandler(),
|
||||||
: CNullDriver(io, params.WindowSize), COGLES1ExtensionHandler(),
|
|
||||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||||
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8)
|
RenderTargetTexture(0), CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8)
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
,HDc(0)
|
, EGLManager(eglManager)
|
||||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
,ViewFramebuffer(0)
|
, Device(device), ViewFramebuffer(0),
|
||||||
,ViewRenderbuffer(0)
|
ViewRenderbuffer(0), ViewDepthRenderbuffer(0)
|
||||||
,ViewDepthRenderbuffer(0)
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("COGLESDriver");
|
setDebugName("COGLESDriver");
|
||||||
#endif
|
#endif
|
||||||
ExposedData=data;
|
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
ExposedData = data;
|
||||||
EglWindow = (NativeWindowType)data.OpenGLWin32.HWnd;
|
core::dimension2d<u32> WindowSize(0, 0);
|
||||||
HDc = GetDC((HWND)EglWindow);
|
|
||||||
EglDisplay = eglGetDisplay((NativeDisplayType)HDc);
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
EGLManager->createEGL();
|
||||||
EglWindow = (NativeWindowType)ExposedData.OpenGLLinux.X11Window;
|
EGLManager->createContext();
|
||||||
EglDisplay = eglGetDisplay((NativeDisplayType)ExposedData.OpenGLLinux.X11Display);
|
|
||||||
|
WindowSize = params.WindowSize;
|
||||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
Device = device;
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
EglWindow = ((struct android_app *)(params.PrivateData))->window;
|
|
||||||
EglDisplay = EGL_NO_DISPLAY;
|
|
||||||
#endif
|
|
||||||
#ifdef EGL_VERSION_1_0
|
|
||||||
if(EglDisplay == EGL_NO_DISPLAY)
|
|
||||||
EglDisplay = eglGetDisplay((NativeDisplayType) EGL_DEFAULT_DISPLAY);
|
|
||||||
if(EglDisplay == EGL_NO_DISPLAY)
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not get OpenGL-ES1 display.");
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLint majorVersion, minorVersion;
|
|
||||||
if (!eglInitialize(EglDisplay, &majorVersion, &minorVersion))
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not initialize OpenGL-ES1 display.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
os::Printer::log("EGL version", core::stringc(majorVersion+(minorVersion/10.f)).c_str());
|
|
||||||
|
|
||||||
EGLint attribs[] =
|
|
||||||
{
|
|
||||||
#if defined( _IRR_COMPILE_WITH_ANDROID_DEVICE_ )
|
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
|
||||||
EGL_BLUE_SIZE, 8,
|
|
||||||
EGL_GREEN_SIZE, 8,
|
|
||||||
EGL_RED_SIZE, 8,
|
|
||||||
EGL_DEPTH_SIZE, 16,
|
|
||||||
EGL_NONE
|
|
||||||
#else
|
|
||||||
EGL_RED_SIZE, 5,
|
|
||||||
EGL_GREEN_SIZE, 5,
|
|
||||||
EGL_BLUE_SIZE, 5,
|
|
||||||
EGL_ALPHA_SIZE, params.WithAlphaChannel?1:0,
|
|
||||||
EGL_BUFFER_SIZE, params.Bits,
|
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
|
||||||
// EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
|
|
||||||
EGL_DEPTH_SIZE, params.ZBufferBits,
|
|
||||||
EGL_STENCIL_SIZE, params.Stencilbuffer,
|
|
||||||
EGL_SAMPLE_BUFFERS, params.AntiAlias?1:0,
|
|
||||||
EGL_SAMPLES, params.AntiAlias,
|
|
||||||
#ifdef EGL_VERSION_1_3
|
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
|
||||||
#endif
|
|
||||||
EGL_NONE, 0
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
EGLint contextAttrib[] =
|
|
||||||
{
|
|
||||||
#ifdef EGL_VERSION_1_3
|
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 1,
|
|
||||||
#endif
|
|
||||||
EGL_NONE, 0
|
|
||||||
};
|
|
||||||
EGLConfig config;
|
|
||||||
EGLint num_configs;
|
|
||||||
u32 steps=5;
|
|
||||||
while (!eglChooseConfig(EglDisplay, attribs, &config, 1, &num_configs) || !num_configs)
|
|
||||||
{
|
|
||||||
switch (steps)
|
|
||||||
{
|
|
||||||
case 5: // samples
|
|
||||||
if (attribs[19]>2)
|
|
||||||
{
|
|
||||||
--attribs[19];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
attribs[17]=0;
|
|
||||||
attribs[19]=0;
|
|
||||||
--steps;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4: // alpha
|
|
||||||
if (attribs[7])
|
|
||||||
{
|
|
||||||
attribs[7]=0;
|
|
||||||
if (params.AntiAlias)
|
|
||||||
{
|
|
||||||
attribs[17]=1;
|
|
||||||
attribs[19]=params.AntiAlias;
|
|
||||||
steps=5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
--steps;
|
|
||||||
break;
|
|
||||||
case 3: // stencil
|
|
||||||
if (attribs[15])
|
|
||||||
{
|
|
||||||
attribs[15]=0;
|
|
||||||
if (params.AntiAlias)
|
|
||||||
{
|
|
||||||
attribs[17]=1;
|
|
||||||
attribs[19]=params.AntiAlias;
|
|
||||||
steps=5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
--steps;
|
|
||||||
break;
|
|
||||||
case 2: // depth size
|
|
||||||
if (attribs[13]>16)
|
|
||||||
{
|
|
||||||
attribs[13]-=8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
--steps;
|
|
||||||
break;
|
|
||||||
case 1: // buffer size
|
|
||||||
if (attribs[9]>16)
|
|
||||||
{
|
|
||||||
attribs[9]-=8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
--steps;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
os::Printer::log("Could not get config for OpenGL-ES1 display.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (params.AntiAlias && !attribs[17])
|
|
||||||
os::Printer::log("No multisampling.");
|
|
||||||
if (params.WithAlphaChannel && !attribs[7])
|
|
||||||
os::Printer::log("No alpha.");
|
|
||||||
if (params.Stencilbuffer && !attribs[15])
|
|
||||||
os::Printer::log("No stencil buffer.");
|
|
||||||
if (params.ZBufferBits > attribs[13])
|
|
||||||
os::Printer::log("No full depth buffer.");
|
|
||||||
if (params.Bits > attribs[9])
|
|
||||||
os::Printer::log("No full color buffer.");
|
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
|
|
||||||
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
|
|
||||||
* As soon as we picked a EGLConfig, we can safely reconfigure the
|
|
||||||
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
|
|
||||||
EGLint format;
|
|
||||||
eglGetConfigAttrib(EglDisplay, config, EGL_NATIVE_VISUAL_ID, &format);
|
|
||||||
|
|
||||||
ANativeWindow_setBuffersGeometry(EglWindow, 0, 0, format);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EglSurface = eglCreateWindowSurface(EglDisplay, config, EglWindow, NULL);
|
|
||||||
|
|
||||||
if (EGL_NO_SURFACE==EglSurface)
|
|
||||||
EglSurface = eglCreateWindowSurface(EglDisplay, config, NULL, NULL);
|
|
||||||
|
|
||||||
if (EGL_NO_SURFACE==EglSurface)
|
|
||||||
{
|
|
||||||
testEGLError();
|
|
||||||
os::Printer::log("Could not create surface for OpenGL-ES1 display.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EGL_VERSION_1_2
|
|
||||||
if (minorVersion>1)
|
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
|
||||||
#endif
|
|
||||||
EglContext = eglCreateContext(EglDisplay, config, EGL_NO_CONTEXT, contextAttrib);
|
|
||||||
if (testEGLError())
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not create Context for OpenGL-ES1 display.");
|
|
||||||
}
|
|
||||||
|
|
||||||
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
|
||||||
if (testEGLError())
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not make Context current for OpenGL-ES1 display.");
|
|
||||||
}
|
|
||||||
|
|
||||||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
|
||||||
|
|
||||||
// set vsync
|
|
||||||
if (params.Vsync)
|
|
||||||
eglSwapInterval(EglDisplay, 1);
|
|
||||||
#elif defined(GL_VERSION_ES_CM_1_0)
|
|
||||||
glGenFramebuffersOES(1, &ViewFramebuffer);
|
glGenFramebuffersOES(1, &ViewFramebuffer);
|
||||||
glGenRenderbuffersOES(1, &ViewRenderbuffer);
|
glGenRenderbuffersOES(1, &ViewRenderbuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
ExposedData.OGLESIPhone.AppDelegate = Device;
|
ExposedData.OGLESIPhone.AppDelegate = Device;
|
||||||
Device->displayInitialize(&ExposedData.OGLESIPhone.Context, &ExposedData.OGLESIPhone.View);
|
Device->displayInitialize(&ExposedData.OGLESIPhone.Context, &ExposedData.OGLESIPhone.View);
|
||||||
#endif
|
|
||||||
|
|
||||||
GLint backingWidth;
|
GLint backingWidth;
|
||||||
GLint backingHeight;
|
GLint backingHeight;
|
||||||
|
@ -259,12 +78,12 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, ViewDepthRenderbuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, ViewDepthRenderbuffer);
|
||||||
|
|
||||||
core::dimension2d<u32> WindowSize(backingWidth, backingHeight);
|
WindowSize = core::dimension2d<u32>(backingWidth, backingHeight);
|
||||||
CNullDriver::ScreenSize = WindowSize;
|
CNullDriver::ScreenSize = WindowSize;
|
||||||
CNullDriver::ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(WindowSize));
|
CNullDriver::ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(WindowSize));
|
||||||
|
|
||||||
genericDriverInit(WindowSize, params.Stencilbuffer);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
genericDriverInit(WindowSize, params.Stencilbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,16 +94,10 @@ COGLES1Driver::~COGLES1Driver()
|
||||||
deleteMaterialRenders();
|
deleteMaterialRenders();
|
||||||
deleteAllTextures();
|
deleteAllTextures();
|
||||||
|
|
||||||
#if defined(EGL_VERSION_1_0)
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
EGLManager->destroyContext();
|
||||||
eglDestroyContext(EglDisplay, EglContext);
|
EGLManager->destroyEGL();
|
||||||
eglDestroySurface(EglDisplay, EglSurface);
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
eglTerminate(EglDisplay);
|
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
|
||||||
if (HDc)
|
|
||||||
ReleaseDC((HWND)EglWindow, HDc);
|
|
||||||
#endif
|
|
||||||
#elif defined(GL_VERSION_ES_CM_1_0)
|
|
||||||
if (0 != ViewFramebuffer)
|
if (0 != ViewFramebuffer)
|
||||||
{
|
{
|
||||||
extGlDeleteFramebuffers(1,&ViewFramebuffer);
|
extGlDeleteFramebuffers(1,&ViewFramebuffer);
|
||||||
|
@ -312,10 +125,6 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
||||||
Name=glGetString(GL_VERSION);
|
Name=glGetString(GL_VERSION);
|
||||||
printVersion();
|
printVersion();
|
||||||
|
|
||||||
#if defined(EGL_VERSION_1_0)
|
|
||||||
os::Printer::log(eglQueryString(EglDisplay, EGL_CLIENT_APIS));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// print renderer information
|
// print renderer information
|
||||||
vendorName = glGetString(GL_VENDOR);
|
vendorName = glGetString(GL_VENDOR);
|
||||||
os::Printer::log(vendorName.c_str(), ELL_INFORMATION);
|
os::Printer::log(vendorName.c_str(), ELL_INFORMATION);
|
||||||
|
@ -324,11 +133,7 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
||||||
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||||
CurrentTexture[i]=0;
|
CurrentTexture[i]=0;
|
||||||
// load extensions
|
// load extensions
|
||||||
initExtensions(this,
|
initExtensions(this, stencilBuffer);
|
||||||
#if defined(EGL_VERSION_1_0)
|
|
||||||
EglDisplay,
|
|
||||||
#endif
|
|
||||||
stencilBuffer);
|
|
||||||
StencilBuffer=stencilBuffer;
|
StencilBuffer=stencilBuffer;
|
||||||
|
|
||||||
DriverAttributes->setAttribute("MaxTextures", MaxTextureUnits);
|
DriverAttributes->setAttribute("MaxTextures", MaxTextureUnits);
|
||||||
|
@ -457,26 +262,12 @@ bool COGLES1Driver::endScene()
|
||||||
{
|
{
|
||||||
CNullDriver::endScene();
|
CNullDriver::endScene();
|
||||||
|
|
||||||
#if defined(EGL_VERSION_1_0)
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
eglSwapBuffers(EglDisplay, EglSurface);
|
EGLManager->swapBuffers();
|
||||||
EGLint g = eglGetError();
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
if (EGL_SUCCESS != g)
|
glFlush();
|
||||||
{
|
|
||||||
if (EGL_CONTEXT_LOST == g)
|
|
||||||
{
|
|
||||||
// o-oh, ogl-es has lost contexts...
|
|
||||||
os::Printer::log("Context lost, please restart your app.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
os::Printer::log("Could not swap buffers for OpenGL-ES1 driver.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#elif defined(GL_VERSION_ES_CM_1_0)
|
|
||||||
glFlush();
|
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, ViewRenderbuffer);
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
Device->displayEnd();
|
Device->displayEnd();
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -490,11 +281,9 @@ bool COGLES1Driver::beginScene(bool backBuffer, bool zBuffer, SColor color,
|
||||||
{
|
{
|
||||||
CNullDriver::beginScene(backBuffer, zBuffer, color);
|
CNullDriver::beginScene(backBuffer, zBuffer, color);
|
||||||
|
|
||||||
#if defined(GL_VERSION_ES_CM_1_0)
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
Device->displayBegin();
|
Device->displayBegin();
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, ViewFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, ViewFramebuffer);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLbitfield mask = 0;
|
GLbitfield mask = 0;
|
||||||
|
@ -1835,49 +1624,6 @@ bool COGLES1Driver::testGLError()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool COGLES1Driver::testEGLError()
|
|
||||||
{
|
|
||||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
|
||||||
EGLint g = eglGetError();
|
|
||||||
switch (g)
|
|
||||||
{
|
|
||||||
case EGL_SUCCESS: return false;
|
|
||||||
case EGL_NOT_INITIALIZED :
|
|
||||||
os::Printer::log("Not Initialized", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_ACCESS:
|
|
||||||
os::Printer::log("Bad Access", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_ALLOC:
|
|
||||||
os::Printer::log("Bad Alloc", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_ATTRIBUTE:
|
|
||||||
os::Printer::log("Bad Attribute", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_CONTEXT:
|
|
||||||
os::Printer::log("Bad Context", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_CONFIG:
|
|
||||||
os::Printer::log("Bad Config", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_CURRENT_SURFACE:
|
|
||||||
os::Printer::log("Bad Current Surface", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_DISPLAY:
|
|
||||||
os::Printer::log("Bad Display", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_SURFACE:
|
|
||||||
os::Printer::log("Bad Surface", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_MATCH:
|
|
||||||
os::Printer::log("Bad Match", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_PARAMETER:
|
|
||||||
os::Printer::log("Bad Parameter", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_NATIVE_PIXMAP:
|
|
||||||
os::Printer::log("Bad Native Pixmap", ELL_ERROR); break;
|
|
||||||
case EGL_BAD_NATIVE_WINDOW:
|
|
||||||
os::Printer::log("Bad Native Window", ELL_ERROR); break;
|
|
||||||
case EGL_CONTEXT_LOST:
|
|
||||||
os::Printer::log("Context Lost", ELL_ERROR); break;
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! sets the needed renderstates
|
//! sets the needed renderstates
|
||||||
void COGLES1Driver::setRenderStates3DMode()
|
void COGLES1Driver::setRenderStates3DMode()
|
||||||
{
|
{
|
||||||
|
@ -3275,51 +3021,27 @@ namespace irr
|
||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
// -----------------------------------
|
|
||||||
// WINDOWS VERSION
|
|
||||||
// -----------------------------------
|
|
||||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_SDL_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||||
video::SExposedVideoData& data, io::IFileSystem* io)
|
video::SExposedVideoData& data, io::IFileSystem* io
|
||||||
{
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
, CEGLManager* eglManager
|
||||||
return new COGLES1Driver(params, data, io);
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
#else
|
, CIrrDeviceIPhone* device
|
||||||
return 0;
|
|
||||||
#endif // _IRR_COMPILE_WITH_OGLES1_
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
)
|
||||||
// -----------------------------------
|
|
||||||
// MACOSX VERSION
|
|
||||||
// -----------------------------------
|
|
||||||
#if defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
|
||||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
|
||||||
io::IFileSystem* io, CIrrDeviceMacOSX *device)
|
|
||||||
{
|
{
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||||
return new COGLES1Driver(params, io, device);
|
return new COGLES1Driver(params, data, io
|
||||||
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
|
, eglManager
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
|
, device
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif // _IRR_COMPILE_WITH_OGLES1_
|
#endif // _IRR_COMPILE_WITH_OGLES1_
|
||||||
}
|
}
|
||||||
#endif // _IRR_COMPILE_WITH_OSX_DEVICE_
|
|
||||||
|
|
||||||
// -----------------------------------
|
|
||||||
// IPHONE VERSION
|
|
||||||
// -----------------------------------
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
|
||||||
video::SExposedVideoData& data, io::IFileSystem* io,
|
|
||||||
CIrrDeviceIPhone* device)
|
|
||||||
{
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
|
||||||
return new COGLES1Driver(params, data, io, device);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif // _IRR_COMPILE_WITH_OGLES1_
|
|
||||||
}
|
|
||||||
#endif // _IRR_COMPILE_WITH_IPHONE_DEVICE_
|
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
|
@ -7,35 +7,18 @@
|
||||||
|
|
||||||
#include "IrrCompileConfig.h"
|
#include "IrrCompileConfig.h"
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
|
||||||
#include "MacOSX/CIrrDeviceMacOSX.h"
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
#include "iOS/CIrrDeviceiOS.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "SIrrCreationParameters.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||||
|
|
||||||
#include "CNullDriver.h"
|
#include "CNullDriver.h"
|
||||||
#include "IMaterialRendererServices.h"
|
#include "IMaterialRendererServices.h"
|
||||||
#include "EDriverFeatures.h"
|
#include "EDriverFeatures.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
#include "SIrrCreationParameters.h"
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
#include <OpenGLES/ES1/gl.h>
|
|
||||||
#include <OpenGLES/ES1/glext.h>
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <GLES/gl.h>
|
|
||||||
#include "android_native_app_glue.h"
|
|
||||||
#else
|
|
||||||
#include <GLES/egl.h>
|
|
||||||
#include <GLES/gl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "libgles_cm.lib")
|
#pragma comment(lib, "libgles_cm.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "COGLESExtensionHandler.h"
|
#include "COGLESExtensionHandler.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
|
@ -48,22 +31,14 @@ namespace video
|
||||||
{
|
{
|
||||||
friend class COGLES1Texture;
|
friend class COGLES1Texture;
|
||||||
public:
|
public:
|
||||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_SDL_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
COGLES1Driver(const SIrrlichtCreationParameters& params,
|
COGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||||
const SExposedVideoData& data,
|
const SExposedVideoData& data, io::IFileSystem* io
|
||||||
io::IFileSystem* io);
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
#endif
|
, CEGLManager* eglManager
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
, CIrrDeviceIPhone* device
|
||||||
COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|
||||||
io::IFileSystem* io, CIrrDeviceMacOSX *device);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
|
||||||
COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|
||||||
const SExposedVideoData& data,
|
|
||||||
io::IFileSystem* io, CIrrDeviceIPhone* device);
|
|
||||||
#endif
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
//! destructor
|
//! destructor
|
||||||
virtual ~COGLES1Driver();
|
virtual ~COGLES1Driver();
|
||||||
|
@ -290,9 +265,6 @@ namespace video
|
||||||
//! checks if an OpenGL error has happend and prints it
|
//! checks if an OpenGL error has happend and prints it
|
||||||
bool testGLError();
|
bool testGLError();
|
||||||
|
|
||||||
//! checks if an OGLES1 error has happend and prints it
|
|
||||||
bool testEGLError();
|
|
||||||
|
|
||||||
//! Set/unset a clipping plane.
|
//! Set/unset a clipping plane.
|
||||||
virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false);
|
virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false);
|
||||||
|
|
||||||
|
@ -392,19 +364,13 @@ namespace video
|
||||||
};
|
};
|
||||||
core::array<RequestedLight> RequestedLights;
|
core::array<RequestedLight> RequestedLights;
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
|
||||||
HDC HDc;
|
|
||||||
#endif
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
CIrrDeviceIPhone* Device;
|
CIrrDeviceIPhone* Device;
|
||||||
GLuint ViewFramebuffer;
|
GLuint ViewFramebuffer;
|
||||||
GLuint ViewRenderbuffer;
|
GLuint ViewRenderbuffer;
|
||||||
GLuint ViewDepthRenderbuffer;
|
GLuint ViewDepthRenderbuffer;
|
||||||
#else
|
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
NativeWindowType EglWindow;
|
CEGLManager* EGLManager;
|
||||||
EGLDisplay EglDisplay;
|
|
||||||
EGLSurface EglSurface;
|
|
||||||
EGLContext EglContext;
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ COGLES1ExtensionHandler::COGLES1ExtensionHandler() :
|
||||||
pGlFramebufferRenderbufferOES(0), pGlFramebufferTexture2DOES(0),
|
pGlFramebufferRenderbufferOES(0), pGlFramebufferTexture2DOES(0),
|
||||||
pGlGenerateMipMapOES(0),
|
pGlGenerateMipMapOES(0),
|
||||||
#endif
|
#endif
|
||||||
EGLVersion(0), Version(0), MaxTextureUnits(0), MaxLights(0),
|
Version(0), MaxTextureUnits(0), MaxLights(0),
|
||||||
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0),
|
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0),
|
||||||
MaxMultipleRenderTargets(1), MaxIndices(65535), MaxTextureSize(1),
|
MaxMultipleRenderTargets(1), MaxIndices(65535), MaxTextureSize(1),
|
||||||
MaxTextureLODBias(0.f), CommonProfile(false),
|
MaxTextureLODBias(0.f), CommonProfile(false),
|
||||||
|
@ -162,18 +162,8 @@ void COGLES1ExtensionHandler::dump() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver,
|
void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver, bool withStencil)
|
||||||
#ifdef EGL_VERSION_1_0
|
|
||||||
EGLDisplay display,
|
|
||||||
#endif
|
|
||||||
bool withStencil)
|
|
||||||
{
|
{
|
||||||
#ifdef EGL_VERSION_1_0
|
|
||||||
const f32 egl_ver = core::fast_atof(reinterpret_cast<const c8*>(eglQueryString(display, EGL_VERSION)));
|
|
||||||
EGLVersion = static_cast<u16>(core::floor32(egl_ver)*100+core::round32(core::fract(egl_ver)*10.0f));
|
|
||||||
core::stringc eglExtensions = eglQueryString(display, EGL_EXTENSIONS);
|
|
||||||
os::Printer::log(eglExtensions.c_str());
|
|
||||||
#endif
|
|
||||||
const core::stringc stringVer(glGetString(GL_VERSION));
|
const core::stringc stringVer(glGetString(GL_VERSION));
|
||||||
CommonProfile = (stringVer[11]=='M');
|
CommonProfile = (stringVer[11]=='M');
|
||||||
const f32 ogl_ver = core::fast_atof(stringVer.c_str()+13);
|
const f32 ogl_ver = core::fast_atof(stringVer.c_str()+13);
|
||||||
|
@ -250,6 +240,7 @@ void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver,
|
||||||
MaxTextureUnits = core::min_(MaxSupportedTextures, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
MaxTextureUnits = core::min_(MaxSupportedTextures, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||||
|
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
||||||
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
if (FeatureAvailable[IRR_OES_draw_texture])
|
if (FeatureAvailable[IRR_OES_draw_texture])
|
||||||
{
|
{
|
||||||
pGlDrawTexiOES = (PFNGLDRAWTEXIOES) eglGetProcAddress("glDrawTexiOES");
|
pGlDrawTexiOES = (PFNGLDRAWTEXIOES) eglGetProcAddress("glDrawTexiOES");
|
||||||
|
@ -272,6 +263,7 @@ void COGLES1ExtensionHandler::initExtensions(COGLES1Driver* driver,
|
||||||
pGlGenerateMipMapOES = (PFNGLGENERATEMIPMAPOES) eglGetProcAddress("glGenerateMipMapOES");
|
pGlGenerateMipMapOES = (PFNGLGENERATEMIPMAPOES) eglGetProcAddress("glGenerateMipMapOES");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -9,22 +9,27 @@
|
||||||
#include "IrrCompileConfig.h"
|
#include "IrrCompileConfig.h"
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||||
|
|
||||||
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
|
#include "CEGLManager.h"
|
||||||
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
|
#include "iOS/CIrrDeviceiOS.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
#include <OpenGLES/ES1/gl.h>
|
#include <OpenGLES/ES1/gl.h>
|
||||||
#include <OpenGLES/ES1/glext.h>
|
#include <OpenGLES/ES1/glext.h>
|
||||||
#elif defined(_IRR_ANDROID_PLATFORM_)
|
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
#include <GLES/glext.h>
|
#include <GLES/glext.h>
|
||||||
#include <EGL/egl.h>
|
|
||||||
#else
|
#else
|
||||||
#include <GLES/egl.h>
|
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
// seems to be missing...
|
|
||||||
typedef char GLchar;
|
typedef char GLchar;
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
||||||
#include "gles-ext.h"
|
#include "gles-ext.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "EDriverFeatures.h"
|
#include "EDriverFeatures.h"
|
||||||
|
|
||||||
|
@ -150,7 +155,6 @@ namespace video
|
||||||
return FeatureAvailable[feature];
|
return FeatureAvailable[feature];
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 EGLVersion;
|
|
||||||
u16 Version;
|
u16 Version;
|
||||||
u8 MaxTextureUnits;
|
u8 MaxTextureUnits;
|
||||||
u8 MaxSupportedTextures;
|
u8 MaxSupportedTextures;
|
||||||
|
@ -217,11 +221,7 @@ namespace video
|
||||||
|
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
void initExtensions(COGLES1Driver* driver,
|
void initExtensions(COGLES1Driver* driver, bool withStencil);
|
||||||
#ifdef EGL_VERSION_1_0
|
|
||||||
EGLDisplay display,
|
|
||||||
#endif
|
|
||||||
bool withStencil);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void extGlBindFramebuffer(GLenum target, GLuint framebuffer)
|
void extGlBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||||
|
|
Loading…
Reference in New Issue