mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-20 17:20:26 +01:00
Split new GL3/GLES2 drivers
The classes are tiny wrappers currently but should they be customized, they are there
This commit is contained in:
parent
2932065346
commit
8dd8652f5f
@ -56,10 +56,15 @@ namespace irr
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static IVideoDriver* createOpenGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||||
|
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||||
|
#else
|
||||||
|
static IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
||||||
{
|
{
|
||||||
return createOpenGL3Driver(params, io, contextManager);
|
os::Printer::log("No OpenGL ES 2 support compiled in.", ELL_ERROR);
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_WEBGL1_
|
#ifdef _IRR_COMPILE_WITH_WEBGL1_
|
||||||
IVideoDriver* createWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
IVideoDriver* createWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||||
@ -506,7 +511,7 @@ void CIrrDeviceSDL::createDriver()
|
|||||||
{
|
{
|
||||||
case video::EDT_OPENGL: VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); break;
|
case video::EDT_OPENGL: VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); break;
|
||||||
case video::EDT_OPENGL3: VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager); break;
|
case video::EDT_OPENGL3: VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager); break;
|
||||||
case video::EDT_OGLES2: VideoDriver = video::createOpenGLES2Driver(CreationParams, FileSystem, ContextManager); break;
|
case video::EDT_OGLES2: VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager); break;
|
||||||
case video::EDT_WEBGL1: VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager); break;
|
case video::EDT_WEBGL1: VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager); break;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +198,14 @@ if(ENABLE_OPENGL)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_OPENGL3)
|
||||||
|
if (NOT USE_SDL2)
|
||||||
|
message(SEND_ERROR "OpenGL3 support requires SDL2")
|
||||||
|
endif()
|
||||||
|
set(USE_SDLGL ON)
|
||||||
|
set(USE_SDLGL3 ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_GLES1)
|
if(ENABLE_GLES1)
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
||||||
if(DEVICE MATCHES "^WINDOWS|X11|ANDROID$")
|
if(DEVICE MATCHES "^WINDOWS|X11|ANDROID$")
|
||||||
@ -213,6 +221,9 @@ if(ENABLE_GLES2)
|
|||||||
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
|
||||||
elseif(DEVICE STREQUAL "IOS")
|
elseif(DEVICE STREQUAL "IOS")
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_EAGL_MANAGER_)
|
add_definitions(-D_IRR_COMPILE_WITH_EAGL_MANAGER_)
|
||||||
|
elseif(DEVICE STREQUAL "SDL")
|
||||||
|
set(USE_SDLGL ON)
|
||||||
|
set(USE_SDLGLES2 ON)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -232,6 +243,7 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "Device: ${DEVICE}")
|
message(STATUS "Device: ${DEVICE}")
|
||||||
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
|
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
|
||||||
|
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
|
||||||
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
||||||
message(STATUS "OpenGL ES 2: ${ENABLE_GLES2}")
|
message(STATUS "OpenGL ES 2: ${ENABLE_GLES2}")
|
||||||
message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
||||||
@ -353,12 +365,6 @@ set(IRRDRVROBJ
|
|||||||
COpenGLExtensionHandler.cpp
|
COpenGLExtensionHandler.cpp
|
||||||
COGLESDriver.cpp
|
COGLESDriver.cpp
|
||||||
COGLESExtensionHandler.cpp
|
COGLESExtensionHandler.cpp
|
||||||
COGLES2Driver.cpp
|
|
||||||
COGLES2ExtensionHandler.cpp
|
|
||||||
COGLES2FixedPipelineRenderer.cpp
|
|
||||||
COGLES2MaterialRenderer.cpp
|
|
||||||
COGLES2Renderer2D.cpp
|
|
||||||
CWebGL1Driver.cpp
|
|
||||||
CGLXManager.cpp
|
CGLXManager.cpp
|
||||||
CWGLManager.cpp
|
CWGLManager.cpp
|
||||||
CEGLManager.cpp
|
CEGLManager.cpp
|
||||||
@ -383,10 +389,7 @@ add_library(IRRVIDEOOBJ OBJECT
|
|||||||
${IRRIMAGEOBJ}
|
${IRRIMAGEOBJ}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_OPENGL3)
|
if(USE_SDLGL)
|
||||||
if (NOT USE_SDL2)
|
|
||||||
message(SEND_ERROR "OpenGL3 support requires SDL2")
|
|
||||||
endif()
|
|
||||||
target_sources(IRRVIDEOOBJ PUBLIC
|
target_sources(IRRVIDEOOBJ PUBLIC
|
||||||
OpenGL/Driver.cpp
|
OpenGL/Driver.cpp
|
||||||
OpenGL/ExtensionHandler.cpp
|
OpenGL/ExtensionHandler.cpp
|
||||||
@ -396,6 +399,27 @@ if(ENABLE_OPENGL3)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_SDLGL3)
|
||||||
|
target_sources(IRRVIDEOOBJ PUBLIC
|
||||||
|
OpenGL3/Driver.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(USE_SDLGLES2)
|
||||||
|
target_sources(IRRVIDEOOBJ PUBLIC
|
||||||
|
OpenGLES2/Driver.cpp
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_sources(IRRVIDEOOBJ PUBLIC
|
||||||
|
COGLES2Driver.cpp
|
||||||
|
COGLES2ExtensionHandler.cpp
|
||||||
|
COGLES2FixedPipelineRenderer.cpp
|
||||||
|
COGLES2MaterialRenderer.cpp
|
||||||
|
COGLES2Renderer2D.cpp
|
||||||
|
CWebGL1Driver.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(IRRIOOBJ OBJECT
|
add_library(IRRIOOBJ OBJECT
|
||||||
CFileList.cpp
|
CFileList.cpp
|
||||||
CFileSystem.cpp
|
CFileSystem.cpp
|
||||||
|
@ -27,10 +27,10 @@ namespace video
|
|||||||
template <class TOpenGLDriver, class TOpenGLTexture>
|
template <class TOpenGLDriver, class TOpenGLTexture>
|
||||||
class COpenGLCoreCacheHandler;
|
class COpenGLCoreCacheHandler;
|
||||||
|
|
||||||
class COpenGL3Driver;
|
class COpenGL3DriverBase;
|
||||||
typedef COpenGLCoreTexture<COpenGL3Driver> COpenGL3Texture;
|
typedef COpenGLCoreTexture<COpenGL3DriverBase> COpenGL3Texture;
|
||||||
typedef COpenGLCoreRenderTarget<COpenGL3Driver, COpenGL3Texture> COpenGL3RenderTarget;
|
typedef COpenGLCoreRenderTarget<COpenGL3DriverBase, COpenGL3Texture> COpenGL3RenderTarget;
|
||||||
typedef COpenGLCoreCacheHandler<COpenGL3Driver, COpenGL3Texture> COpenGL3CacheHandler;
|
typedef COpenGLCoreCacheHandler<COpenGL3DriverBase, COpenGL3Texture> COpenGL3CacheHandler;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,17 +123,17 @@ namespace video
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void APIENTRY COpenGL3Driver::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)
|
void APIENTRY COpenGL3DriverBase::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam)
|
||||||
{
|
{
|
||||||
((COpenGL3Driver *)userParam)->debugCb(source, type, id, severity, length, message);
|
((COpenGL3DriverBase *)userParam)->debugCb(source, type, id, severity, length, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message)
|
void COpenGL3DriverBase::debugCb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message)
|
||||||
{
|
{
|
||||||
printf("%04x %04x %x %x %.*s\n", source, type, id, severity, length, message);
|
printf("%04x %04x %x %x %.*s\n", source, type, id, severity, length, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
COpenGL3Driver::COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager) :
|
COpenGL3DriverBase::COpenGL3DriverBase(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager) :
|
||||||
CNullDriver(io, params.WindowSize), COpenGL3ExtensionHandler(), CacheHandler(0),
|
CNullDriver(io, params.WindowSize), COpenGL3ExtensionHandler(), CacheHandler(0),
|
||||||
Params(params), ResetRenderStates(true), LockRenderStateMode(false), AntiAlias(params.AntiAlias),
|
Params(params), ResetRenderStates(true), LockRenderStateMode(false), AntiAlias(params.AntiAlias),
|
||||||
MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0),
|
MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0),
|
||||||
@ -158,7 +158,7 @@ COpenGL3Driver::COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IF
|
|||||||
initQuadsIndices();
|
initQuadsIndices();
|
||||||
}
|
}
|
||||||
|
|
||||||
COpenGL3Driver::~COpenGL3Driver()
|
COpenGL3DriverBase::~COpenGL3DriverBase()
|
||||||
{
|
{
|
||||||
deleteMaterialRenders();
|
deleteMaterialRenders();
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::initQuadsIndices(int max_vertex_count)
|
void COpenGL3DriverBase::initQuadsIndices(int max_vertex_count)
|
||||||
{
|
{
|
||||||
int max_quad_count = max_vertex_count / 4;
|
int max_quad_count = max_vertex_count / 4;
|
||||||
QuadsIndices.reserve(6 * max_quad_count);
|
QuadsIndices.reserve(6 * max_quad_count);
|
||||||
@ -196,7 +196,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer)
|
bool COpenGL3DriverBase::genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer)
|
||||||
{
|
{
|
||||||
Name = glGetString(GL_VERSION);
|
Name = glGetString(GL_VERSION);
|
||||||
printVersion();
|
printVersion();
|
||||||
@ -261,7 +261,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::loadShaderData(const io::path& vertexShaderName, const io::path& fragmentShaderName, c8** vertexShaderData, c8** fragmentShaderData)
|
void COpenGL3DriverBase::loadShaderData(const io::path& vertexShaderName, const io::path& fragmentShaderName, c8** vertexShaderData, c8** fragmentShaderData)
|
||||||
{
|
{
|
||||||
io::path vsPath(OGLES2ShaderPath);
|
io::path vsPath(OGLES2ShaderPath);
|
||||||
vsPath += vertexShaderName;
|
vsPath += vertexShaderName;
|
||||||
@ -316,7 +316,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
fsFile->drop();
|
fsFile->drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::createMaterialRenderers()
|
void COpenGL3DriverBase::createMaterialRenderers()
|
||||||
{
|
{
|
||||||
// Create callbacks.
|
// Create callbacks.
|
||||||
|
|
||||||
@ -469,13 +469,13 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
delete[] fs2DData;
|
delete[] fs2DData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture)
|
bool COpenGL3DriverBase::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture)
|
||||||
{
|
{
|
||||||
Material.TextureLayer[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
|
Material.TextureLayer[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
|
||||||
return CacheHandler->getTextureCache().set(0, texture);
|
return CacheHandler->getTextureCache().set(0, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
|
bool COpenGL3DriverBase::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil, const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
|
||||||
{
|
{
|
||||||
CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect);
|
CNullDriver::beginScene(clearFlag, clearColor, clearDepth, clearStencil, videoData, sourceRect);
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::endScene()
|
bool COpenGL3DriverBase::endScene()
|
||||||
{
|
{
|
||||||
CNullDriver::endScene();
|
CNullDriver::endScene();
|
||||||
|
|
||||||
@ -501,21 +501,21 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Returns the transformation set by setTransform
|
//! Returns the transformation set by setTransform
|
||||||
const core::matrix4& COpenGL3Driver::getTransform(E_TRANSFORMATION_STATE state) const
|
const core::matrix4& COpenGL3DriverBase::getTransform(E_TRANSFORMATION_STATE state) const
|
||||||
{
|
{
|
||||||
return Matrices[state];
|
return Matrices[state];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! sets transformation
|
//! sets transformation
|
||||||
void COpenGL3Driver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
void COpenGL3DriverBase::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
|
||||||
{
|
{
|
||||||
Matrices[state] = mat;
|
Matrices[state] = mat;
|
||||||
Transformation3DChanged = true;
|
Transformation3DChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool COpenGL3Driver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
|
bool COpenGL3DriverBase::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
|
||||||
{
|
{
|
||||||
if (!HWBuffer)
|
if (!HWBuffer)
|
||||||
return false;
|
return false;
|
||||||
@ -563,7 +563,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool COpenGL3Driver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
|
bool COpenGL3DriverBase::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
|
||||||
{
|
{
|
||||||
if (!HWBuffer)
|
if (!HWBuffer)
|
||||||
return false;
|
return false;
|
||||||
@ -627,7 +627,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! updates hardware buffer if needed
|
//! updates hardware buffer if needed
|
||||||
bool COpenGL3Driver::updateHardwareBuffer(SHWBufferLink *HWBuffer)
|
bool COpenGL3DriverBase::updateHardwareBuffer(SHWBufferLink *HWBuffer)
|
||||||
{
|
{
|
||||||
if (!HWBuffer)
|
if (!HWBuffer)
|
||||||
return false;
|
return false;
|
||||||
@ -663,7 +663,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Create hardware buffer from meshbuffer
|
//! Create hardware buffer from meshbuffer
|
||||||
COpenGL3Driver::SHWBufferLink *COpenGL3Driver::createHardwareBuffer(const scene::IMeshBuffer* mb)
|
COpenGL3DriverBase::SHWBufferLink *COpenGL3DriverBase::createHardwareBuffer(const scene::IMeshBuffer* mb)
|
||||||
{
|
{
|
||||||
if (!mb || (mb->getHardwareMappingHint_Index() == scene::EHM_NEVER && mb->getHardwareMappingHint_Vertex() == scene::EHM_NEVER))
|
if (!mb || (mb->getHardwareMappingHint_Index() == scene::EHM_NEVER && mb->getHardwareMappingHint_Vertex() == scene::EHM_NEVER))
|
||||||
return 0;
|
return 0;
|
||||||
@ -692,7 +692,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer)
|
void COpenGL3DriverBase::deleteHardwareBuffer(SHWBufferLink *_HWBuffer)
|
||||||
{
|
{
|
||||||
if (!_HWBuffer)
|
if (!_HWBuffer)
|
||||||
return;
|
return;
|
||||||
@ -714,7 +714,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Draw hardware buffer
|
//! Draw hardware buffer
|
||||||
void COpenGL3Driver::drawHardwareBuffer(SHWBufferLink *_HWBuffer)
|
void COpenGL3DriverBase::drawHardwareBuffer(SHWBufferLink *_HWBuffer)
|
||||||
{
|
{
|
||||||
if (!_HWBuffer)
|
if (!_HWBuffer)
|
||||||
return;
|
return;
|
||||||
@ -753,7 +753,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IRenderTarget* COpenGL3Driver::addRenderTarget()
|
IRenderTarget* COpenGL3DriverBase::addRenderTarget()
|
||||||
{
|
{
|
||||||
COpenGL3RenderTarget* renderTarget = new COpenGL3RenderTarget(this);
|
COpenGL3RenderTarget* renderTarget = new COpenGL3RenderTarget(this);
|
||||||
RenderTargets.push_back(renderTarget);
|
RenderTargets.push_back(renderTarget);
|
||||||
@ -770,7 +770,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! draws a vertex primitive list
|
//! draws a vertex primitive list
|
||||||
void COpenGL3Driver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
void COpenGL3DriverBase::drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
||||||
const void* indexList, u32 primitiveCount,
|
const void* indexList, u32 primitiveCount,
|
||||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
|
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType)
|
||||||
{
|
{
|
||||||
@ -842,7 +842,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
|
void COpenGL3DriverBase::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
|
||||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, SColor color,
|
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, SColor color,
|
||||||
bool useAlphaChannelOfTexture)
|
bool useAlphaChannelOfTexture)
|
||||||
{
|
{
|
||||||
@ -857,7 +857,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
void COpenGL3DriverBase::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
||||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
||||||
const video::SColor* const colors, bool useAlphaChannelOfTexture)
|
const video::SColor* const colors, bool useAlphaChannelOfTexture)
|
||||||
{
|
{
|
||||||
@ -924,7 +924,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
testGLError(__LINE__);
|
testGLError(__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::draw2DImage(const video::ITexture* texture, u32 layer, bool flip)
|
void COpenGL3DriverBase::draw2DImage(const video::ITexture* texture, u32 layer, bool flip)
|
||||||
{
|
{
|
||||||
if (!texture)
|
if (!texture)
|
||||||
return;
|
return;
|
||||||
@ -957,7 +957,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
drawQuad(vt2DImage, quad2DVertices);
|
drawQuad(vt2DImage, quad2DVertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::draw2DImageBatch(const video::ITexture* texture,
|
void COpenGL3DriverBase::draw2DImageBatch(const video::ITexture* texture,
|
||||||
const core::array<core::position2d<s32> >& positions,
|
const core::array<core::position2d<s32> >& positions,
|
||||||
const core::array<core::rect<s32> >& sourceRects,
|
const core::array<core::rect<s32> >& sourceRects,
|
||||||
const core::rect<s32>* clipRect,
|
const core::rect<s32>* clipRect,
|
||||||
@ -1033,7 +1033,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! draw a 2d rectangle
|
//! draw a 2d rectangle
|
||||||
void COpenGL3Driver::draw2DRectangle(SColor color,
|
void COpenGL3DriverBase::draw2DRectangle(SColor color,
|
||||||
const core::rect<s32>& position,
|
const core::rect<s32>& position,
|
||||||
const core::rect<s32>* clip)
|
const core::rect<s32>* clip)
|
||||||
{
|
{
|
||||||
@ -1068,7 +1068,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! draw an 2d rectangle
|
//! draw an 2d rectangle
|
||||||
void COpenGL3Driver::draw2DRectangle(const core::rect<s32>& position,
|
void COpenGL3DriverBase::draw2DRectangle(const core::rect<s32>& position,
|
||||||
SColor colorLeftUp, SColor colorRightUp,
|
SColor colorLeftUp, SColor colorRightUp,
|
||||||
SColor colorLeftDown, SColor colorRightDown,
|
SColor colorLeftDown, SColor colorRightDown,
|
||||||
const core::rect<s32>* clip)
|
const core::rect<s32>* clip)
|
||||||
@ -1107,7 +1107,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Draws a 2d line.
|
//! Draws a 2d line.
|
||||||
void COpenGL3Driver::draw2DLine(const core::position2d<s32>& start,
|
void COpenGL3DriverBase::draw2DLine(const core::position2d<s32>& start,
|
||||||
const core::position2d<s32>& end, SColor color)
|
const core::position2d<s32>& end, SColor color)
|
||||||
{
|
{
|
||||||
if (start==end)
|
if (start==end)
|
||||||
@ -1136,7 +1136,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Draws a pixel
|
//! Draws a pixel
|
||||||
void COpenGL3Driver::drawPixel(u32 x, u32 y, const SColor &color)
|
void COpenGL3DriverBase::drawPixel(u32 x, u32 y, const SColor &color)
|
||||||
{
|
{
|
||||||
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
|
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
|
||||||
if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height)
|
if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height)
|
||||||
@ -1156,26 +1156,26 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
drawArrays(GL_POINTS, vtPrimitive, vertices, 1);
|
drawArrays(GL_POINTS, vtPrimitive, vertices, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::drawQuad(const VertexType &vertexType, const S3DVertex (&vertices)[4])
|
void COpenGL3DriverBase::drawQuad(const VertexType &vertexType, const S3DVertex (&vertices)[4])
|
||||||
{
|
{
|
||||||
drawArrays(GL_TRIANGLE_FAN, vertexType, vertices, 4);
|
drawArrays(GL_TRIANGLE_FAN, vertexType, vertices, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::drawArrays(GLenum primitiveType, const VertexType &vertexType, const void *vertices, int vertexCount)
|
void COpenGL3DriverBase::drawArrays(GLenum primitiveType, const VertexType &vertexType, const void *vertices, int vertexCount)
|
||||||
{
|
{
|
||||||
beginDraw(vertexType, reinterpret_cast<uintptr_t>(vertices));
|
beginDraw(vertexType, reinterpret_cast<uintptr_t>(vertices));
|
||||||
glDrawArrays(primitiveType, 0, vertexCount);
|
glDrawArrays(primitiveType, 0, vertexCount);
|
||||||
endDraw(vertexType);
|
endDraw(vertexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::drawElements(GLenum primitiveType, const VertexType &vertexType, const void *vertices, const u16 *indices, int indexCount)
|
void COpenGL3DriverBase::drawElements(GLenum primitiveType, const VertexType &vertexType, const void *vertices, const u16 *indices, int indexCount)
|
||||||
{
|
{
|
||||||
beginDraw(vertexType, reinterpret_cast<uintptr_t>(vertices));
|
beginDraw(vertexType, reinterpret_cast<uintptr_t>(vertices));
|
||||||
glDrawElements(primitiveType, indexCount, GL_UNSIGNED_SHORT, indices);
|
glDrawElements(primitiveType, indexCount, GL_UNSIGNED_SHORT, indices);
|
||||||
endDraw(vertexType);
|
endDraw(vertexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::beginDraw(const VertexType &vertexType, uintptr_t verticesBase)
|
void COpenGL3DriverBase::beginDraw(const VertexType &vertexType, uintptr_t verticesBase)
|
||||||
{
|
{
|
||||||
for (auto attr: vertexType) {
|
for (auto attr: vertexType) {
|
||||||
glEnableVertexAttribArray(attr.Index);
|
glEnableVertexAttribArray(attr.Index);
|
||||||
@ -1187,13 +1187,13 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::endDraw(const VertexType &vertexType)
|
void COpenGL3DriverBase::endDraw(const VertexType &vertexType)
|
||||||
{
|
{
|
||||||
for (auto attr: vertexType)
|
for (auto attr: vertexType)
|
||||||
glDisableVertexAttribArray(attr.Index);
|
glDisableVertexAttribArray(attr.Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
ITexture* COpenGL3Driver::createDeviceDependentTexture(const io::path& name, IImage* image)
|
ITexture* COpenGL3DriverBase::createDeviceDependentTexture(const io::path& name, IImage* image)
|
||||||
{
|
{
|
||||||
core::array<IImage*> imageArray(1);
|
core::array<IImage*> imageArray(1);
|
||||||
imageArray.push_back(image);
|
imageArray.push_back(image);
|
||||||
@ -1203,7 +1203,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITexture* COpenGL3Driver::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)
|
ITexture* COpenGL3DriverBase::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)
|
||||||
{
|
{
|
||||||
COpenGL3Texture* texture = new COpenGL3Texture(name, image, ETT_CUBEMAP, this);
|
COpenGL3Texture* texture = new COpenGL3Texture(name, image, ETT_CUBEMAP, this);
|
||||||
|
|
||||||
@ -1211,7 +1211,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a material.
|
//! Sets a material.
|
||||||
void COpenGL3Driver::setMaterial(const SMaterial& material)
|
void COpenGL3DriverBase::setMaterial(const SMaterial& material)
|
||||||
{
|
{
|
||||||
Material = material;
|
Material = material;
|
||||||
OverrideMaterial.apply(Material);
|
OverrideMaterial.apply(Material);
|
||||||
@ -1224,7 +1224,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! prints error if an error happened.
|
//! prints error if an error happened.
|
||||||
bool COpenGL3Driver::testGLError(int code)
|
bool COpenGL3DriverBase::testGLError(int code)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
GLenum g = glGetError();
|
GLenum g = glGetError();
|
||||||
@ -1252,7 +1252,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! prints error if an error happened.
|
//! prints error if an error happened.
|
||||||
bool COpenGL3Driver::testEGLError()
|
bool COpenGL3DriverBase::testEGLError()
|
||||||
{
|
{
|
||||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
||||||
EGLint g = eglGetError();
|
EGLint g = eglGetError();
|
||||||
@ -1310,7 +1310,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::setRenderStates3DMode()
|
void COpenGL3DriverBase::setRenderStates3DMode()
|
||||||
{
|
{
|
||||||
if ( LockRenderStateMode )
|
if ( LockRenderStateMode )
|
||||||
return;
|
return;
|
||||||
@ -1355,7 +1355,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Can be called by an IMaterialRenderer to make its work easier.
|
//! Can be called by an IMaterialRenderer to make its work easier.
|
||||||
void COpenGL3Driver::setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, bool resetAllRenderStates)
|
void COpenGL3DriverBase::setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, bool resetAllRenderStates)
|
||||||
{
|
{
|
||||||
// ZBuffer
|
// ZBuffer
|
||||||
switch (material.ZBuffer)
|
switch (material.ZBuffer)
|
||||||
@ -1493,7 +1493,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
||||||
void COpenGL3Driver::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates)
|
void COpenGL3DriverBase::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates)
|
||||||
{
|
{
|
||||||
// Set textures to TU/TIU and apply filters to them
|
// Set textures to TU/TIU and apply filters to them
|
||||||
|
|
||||||
@ -1579,7 +1579,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
// Get OpenGL ES2.0 texture wrap mode from Irrlicht wrap mode.
|
// Get OpenGL ES2.0 texture wrap mode from Irrlicht wrap mode.
|
||||||
GLint COpenGL3Driver::getTextureWrapMode(u8 clamp) const
|
GLint COpenGL3DriverBase::getTextureWrapMode(u8 clamp) const
|
||||||
{
|
{
|
||||||
switch (clamp)
|
switch (clamp)
|
||||||
{
|
{
|
||||||
@ -1596,7 +1596,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! sets the needed renderstates
|
//! sets the needed renderstates
|
||||||
void COpenGL3Driver::setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel)
|
void COpenGL3DriverBase::setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel)
|
||||||
{
|
{
|
||||||
if ( LockRenderStateMode )
|
if ( LockRenderStateMode )
|
||||||
return;
|
return;
|
||||||
@ -1652,7 +1652,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::chooseMaterial2D()
|
void COpenGL3DriverBase::chooseMaterial2D()
|
||||||
{
|
{
|
||||||
if (!OverrideMaterial2DEnabled)
|
if (!OverrideMaterial2DEnabled)
|
||||||
Material = InitMaterial2D;
|
Material = InitMaterial2D;
|
||||||
@ -1670,12 +1670,12 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! \return Returns the name of the video driver.
|
//! \return Returns the name of the video driver.
|
||||||
const wchar_t* COpenGL3Driver::getName() const
|
const wchar_t* COpenGL3DriverBase::getName() const
|
||||||
{
|
{
|
||||||
return Name.c_str();
|
return Name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::setViewPort(const core::rect<s32>& area)
|
void COpenGL3DriverBase::setViewPort(const core::rect<s32>& area)
|
||||||
{
|
{
|
||||||
core::rect<s32> vp = area;
|
core::rect<s32> vp = area;
|
||||||
core::rect<s32> rendert(0, 0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
|
core::rect<s32> rendert(0, 0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
|
||||||
@ -1688,7 +1688,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGL3Driver::setViewPortRaw(u32 width, u32 height)
|
void COpenGL3DriverBase::setViewPortRaw(u32 width, u32 height)
|
||||||
{
|
{
|
||||||
CacheHandler->setViewport(0, 0, width, height);
|
CacheHandler->setViewport(0, 0, width, height);
|
||||||
ViewPort = core::recti(0, 0, width, height);
|
ViewPort = core::recti(0, 0, width, height);
|
||||||
@ -1696,7 +1696,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Draws a 3d line.
|
//! Draws a 3d line.
|
||||||
void COpenGL3Driver::draw3DLine(const core::vector3df& start,
|
void COpenGL3DriverBase::draw3DLine(const core::vector3df& start,
|
||||||
const core::vector3df& end, SColor color)
|
const core::vector3df& end, SColor color)
|
||||||
{
|
{
|
||||||
setRenderStates3DMode();
|
setRenderStates3DMode();
|
||||||
@ -1711,7 +1711,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
//! Only used by the internal engine. Used to notify the driver that
|
//! Only used by the internal engine. Used to notify the driver that
|
||||||
//! the window was resized.
|
//! the window was resized.
|
||||||
void COpenGL3Driver::OnResize(const core::dimension2d<u32>& size)
|
void COpenGL3DriverBase::OnResize(const core::dimension2d<u32>& size)
|
||||||
{
|
{
|
||||||
CNullDriver::OnResize(size);
|
CNullDriver::OnResize(size);
|
||||||
CacheHandler->setViewport(0, 0, size.Width, size.Height);
|
CacheHandler->setViewport(0, 0, size.Width, size.Height);
|
||||||
@ -1720,79 +1720,79 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Returns type of video driver
|
//! Returns type of video driver
|
||||||
E_DRIVER_TYPE COpenGL3Driver::getDriverType() const
|
E_DRIVER_TYPE COpenGL3DriverBase::getDriverType() const
|
||||||
{
|
{
|
||||||
return EDT_OPENGL3;
|
return EDT_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! returns color format
|
//! returns color format
|
||||||
ECOLOR_FORMAT COpenGL3Driver::getColorFormat() const
|
ECOLOR_FORMAT COpenGL3DriverBase::getColorFormat() const
|
||||||
{
|
{
|
||||||
return ColorFormat;
|
return ColorFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Get a vertex shader constant index.
|
//! Get a vertex shader constant index.
|
||||||
s32 COpenGL3Driver::getVertexShaderConstantID(const c8* name)
|
s32 COpenGL3DriverBase::getVertexShaderConstantID(const c8* name)
|
||||||
{
|
{
|
||||||
return getPixelShaderConstantID(name);
|
return getPixelShaderConstantID(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Get a pixel shader constant index.
|
//! Get a pixel shader constant index.
|
||||||
s32 COpenGL3Driver::getPixelShaderConstantID(const c8* name)
|
s32 COpenGL3DriverBase::getPixelShaderConstantID(const c8* name)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->getPixelShaderConstantID(), not VideoDriver->getPixelShaderConstantID().");
|
os::Printer::log("Error: Please call services->getPixelShaderConstantID(), not VideoDriver->getPixelShaderConstantID().");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
//! Sets a vertex shader constant.
|
||||||
void COpenGL3Driver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
void COpenGL3DriverBase::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
//! Sets a pixel shader constant.
|
||||||
void COpenGL3Driver::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
void COpenGL3DriverBase::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a constant for the vertex shader based on an index.
|
//! Sets a constant for the vertex shader based on an index.
|
||||||
bool COpenGL3Driver::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
bool COpenGL3DriverBase::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Int interface for the above.
|
//! Int interface for the above.
|
||||||
bool COpenGL3Driver::setVertexShaderConstant(s32 index, const s32* ints, int count)
|
bool COpenGL3DriverBase::setVertexShaderConstant(s32 index, const s32* ints, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::setVertexShaderConstant(s32 index, const u32* ints, int count)
|
bool COpenGL3DriverBase::setVertexShaderConstant(s32 index, const u32* ints, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
os::Printer::log("Error: Please call services->setVertexShaderConstant(), not VideoDriver->setVertexShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a constant for the pixel shader based on an index.
|
//! Sets a constant for the pixel shader based on an index.
|
||||||
bool COpenGL3Driver::setPixelShaderConstant(s32 index, const f32* floats, int count)
|
bool COpenGL3DriverBase::setPixelShaderConstant(s32 index, const f32* floats, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Int interface for the above.
|
//! Int interface for the above.
|
||||||
bool COpenGL3Driver::setPixelShaderConstant(s32 index, const s32* ints, int count)
|
bool COpenGL3DriverBase::setPixelShaderConstant(s32 index, const s32* ints, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::setPixelShaderConstant(s32 index, const u32* ints, int count)
|
bool COpenGL3DriverBase::setPixelShaderConstant(s32 index, const u32* ints, int count)
|
||||||
{
|
{
|
||||||
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
os::Printer::log("Error: Please call services->setPixelShaderConstant(), not VideoDriver->setPixelShaderConstant().");
|
||||||
return false;
|
return false;
|
||||||
@ -1800,7 +1800,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
||||||
//! vertex shaders to render geometry.
|
//! vertex shaders to render geometry.
|
||||||
s32 COpenGL3Driver::addShaderMaterial(const c8* vertexShaderProgram,
|
s32 COpenGL3DriverBase::addShaderMaterial(const c8* vertexShaderProgram,
|
||||||
const c8* pixelShaderProgram,
|
const c8* pixelShaderProgram,
|
||||||
IShaderConstantSetCallBack* callback,
|
IShaderConstantSetCallBack* callback,
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
||||||
@ -1811,7 +1811,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
||||||
s32 COpenGL3Driver::addHighLevelShaderMaterial(
|
s32 COpenGL3DriverBase::addHighLevelShaderMaterial(
|
||||||
const c8* vertexShaderProgram,
|
const c8* vertexShaderProgram,
|
||||||
const c8* vertexShaderEntryPointName,
|
const c8* vertexShaderEntryPointName,
|
||||||
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
E_VERTEX_SHADER_TYPE vsCompileTarget,
|
||||||
@ -1840,19 +1840,19 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
//! Returns a pointer to the IVideoDriver interface. (Implementation for
|
//! Returns a pointer to the IVideoDriver interface. (Implementation for
|
||||||
//! IMaterialRendererServices)
|
//! IMaterialRendererServices)
|
||||||
IVideoDriver* COpenGL3Driver::getVideoDriver()
|
IVideoDriver* COpenGL3DriverBase::getVideoDriver()
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns pointer to the IGPUProgrammingServices interface.
|
//! Returns pointer to the IGPUProgrammingServices interface.
|
||||||
IGPUProgrammingServices* COpenGL3Driver::getGPUProgrammingServices()
|
IGPUProgrammingServices* COpenGL3DriverBase::getGPUProgrammingServices()
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITexture* COpenGL3Driver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
ITexture* COpenGL3DriverBase::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||||
const io::path& name, const ECOLOR_FORMAT format)
|
const io::path& name, const ECOLOR_FORMAT format)
|
||||||
{
|
{
|
||||||
//disable mip-mapping
|
//disable mip-mapping
|
||||||
@ -1869,7 +1869,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return renderTargetTexture;
|
return renderTargetTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITexture* COpenGL3Driver::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
|
ITexture* COpenGL3DriverBase::addRenderTargetTextureCubemap(const irr::u32 sideLen, const io::path& name, const ECOLOR_FORMAT format)
|
||||||
{
|
{
|
||||||
//disable mip-mapping
|
//disable mip-mapping
|
||||||
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||||
@ -1898,14 +1898,14 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
|
|
||||||
|
|
||||||
//! Returns the maximum amount of primitives
|
//! Returns the maximum amount of primitives
|
||||||
u32 COpenGL3Driver::getMaximalPrimitiveCount() const
|
u32 COpenGL3DriverBase::getMaximalPrimitiveCount() const
|
||||||
{
|
{
|
||||||
return 65535;
|
return 65535;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil)
|
bool COpenGL3DriverBase::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor, f32 clearDepth, u8 clearStencil)
|
||||||
{
|
{
|
||||||
if (target && target->getDriverType() != EDT_OPENGL3)
|
if (target && target->getDriverType() != getDriverType())
|
||||||
{
|
{
|
||||||
os::Printer::log("Fatal Error: Tried to set a render target not owned by OpenGL 3 driver.", ELL_ERROR);
|
os::Printer::log("Fatal Error: Tried to set a render target not owned by OpenGL 3 driver.", ELL_ERROR);
|
||||||
return false;
|
return false;
|
||||||
@ -1947,7 +1947,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil)
|
void COpenGL3DriverBase::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil)
|
||||||
{
|
{
|
||||||
GLbitfield mask = 0;
|
GLbitfield mask = 0;
|
||||||
u8 colorMask = 0;
|
u8 colorMask = 0;
|
||||||
@ -1992,7 +1992,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
// We want to read the front buffer to get the latest render finished.
|
// We want to read the front buffer to get the latest render finished.
|
||||||
// This is not possible under ogl-es, though, so one has to call this method
|
// This is not possible under ogl-es, though, so one has to call this method
|
||||||
// outside of the render loop only.
|
// outside of the render loop only.
|
||||||
IImage* COpenGL3Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target)
|
IImage* COpenGL3DriverBase::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target)
|
||||||
{
|
{
|
||||||
if (target==video::ERT_MULTI_RENDER_TEXTURES || target==video::ERT_RENDER_TEXTURE || target==video::ERT_STEREO_BOTH_BUFFERS)
|
if (target==video::ERT_MULTI_RENDER_TEXTURES || target==video::ERT_RENDER_TEXTURE || target==video::ERT_STEREO_BOTH_BUFFERS)
|
||||||
return 0;
|
return 0;
|
||||||
@ -2078,14 +2078,14 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return newImage;
|
return newImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGL3Driver::removeTexture(ITexture* texture)
|
void COpenGL3DriverBase::removeTexture(ITexture* texture)
|
||||||
{
|
{
|
||||||
CacheHandler->getTextureCache().remove(texture);
|
CacheHandler->getTextureCache().remove(texture);
|
||||||
CNullDriver::removeTexture(texture);
|
CNullDriver::removeTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Set/unset a clipping plane.
|
//! Set/unset a clipping plane.
|
||||||
bool COpenGL3Driver::setClipPlane(u32 index, const core::plane3df& plane, bool enable)
|
bool COpenGL3DriverBase::setClipPlane(u32 index, const core::plane3df& plane, bool enable)
|
||||||
{
|
{
|
||||||
if (index >= UserClipPlane.size())
|
if (index >= UserClipPlane.size())
|
||||||
UserClipPlane.push_back(SUserClipPlane());
|
UserClipPlane.push_back(SUserClipPlane());
|
||||||
@ -2096,18 +2096,18 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Enable/disable a clipping plane.
|
//! Enable/disable a clipping plane.
|
||||||
void COpenGL3Driver::enableClipPlane(u32 index, bool enable)
|
void COpenGL3DriverBase::enableClipPlane(u32 index, bool enable)
|
||||||
{
|
{
|
||||||
UserClipPlane[index].Enabled = enable;
|
UserClipPlane[index].Enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Get the ClipPlane Count
|
//! Get the ClipPlane Count
|
||||||
u32 COpenGL3Driver::getClipPlaneCount() const
|
u32 COpenGL3DriverBase::getClipPlaneCount() const
|
||||||
{
|
{
|
||||||
return UserClipPlane.size();
|
return UserClipPlane.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const core::plane3df& COpenGL3Driver::getClipPlane(irr::u32 index) const
|
const core::plane3df& COpenGL3DriverBase::getClipPlane(irr::u32 index) const
|
||||||
{
|
{
|
||||||
if (index < UserClipPlane.size())
|
if (index < UserClipPlane.size())
|
||||||
return UserClipPlane[index].Plane;
|
return UserClipPlane[index].Plane;
|
||||||
@ -2119,12 +2119,12 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core::dimension2du COpenGL3Driver::getMaxTextureSize() const
|
core::dimension2du COpenGL3DriverBase::getMaxTextureSize() const
|
||||||
{
|
{
|
||||||
return core::dimension2du(MaxTextureSize, MaxTextureSize);
|
return core::dimension2du(MaxTextureSize, MaxTextureSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum COpenGL3Driver::getGLBlend(E_BLEND_FACTOR factor) const
|
GLenum COpenGL3DriverBase::getGLBlend(E_BLEND_FACTOR factor) const
|
||||||
{
|
{
|
||||||
static GLenum const blendTable[] =
|
static GLenum const blendTable[] =
|
||||||
{
|
{
|
||||||
@ -2144,7 +2144,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return blendTable[factor];
|
return blendTable[factor];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
bool COpenGL3DriverBase::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||||
{
|
{
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
@ -2360,7 +2360,7 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::queryTextureFormat(ECOLOR_FORMAT format) const
|
bool COpenGL3DriverBase::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||||
{
|
{
|
||||||
GLint dummyInternalFormat;
|
GLint dummyInternalFormat;
|
||||||
GLenum dummyPixelFormat;
|
GLenum dummyPixelFormat;
|
||||||
@ -2369,28 +2369,20 @@ COpenGL3Driver::~COpenGL3Driver()
|
|||||||
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COpenGL3Driver::needsTransparentRenderPass(const irr::video::SMaterial& material) const
|
bool COpenGL3DriverBase::needsTransparentRenderPass(const irr::video::SMaterial& material) const
|
||||||
{
|
{
|
||||||
return CNullDriver::needsTransparentRenderPass(material) || material.isAlphaBlendOperation();
|
return CNullDriver::needsTransparentRenderPass(material) || material.isAlphaBlendOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SMaterial& COpenGL3Driver::getCurrentMaterial() const
|
const SMaterial& COpenGL3DriverBase::getCurrentMaterial() const
|
||||||
{
|
{
|
||||||
return Material;
|
return Material;
|
||||||
}
|
}
|
||||||
|
|
||||||
COpenGL3CacheHandler* COpenGL3Driver::getCacheHandler() const
|
COpenGL3CacheHandler* COpenGL3DriverBase::getCacheHandler() const
|
||||||
{
|
{
|
||||||
return CacheHandler;
|
return CacheHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
|
||||||
{
|
|
||||||
COpenGL3Driver* driver = new COpenGL3Driver(params, io, contextManager);
|
|
||||||
driver->genericDriverInit(params.WindowSize, params.Stencilbuffer); // don't call in constructor, it uses virtual function calls of driver
|
|
||||||
return driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
@ -25,19 +25,18 @@ namespace video
|
|||||||
class COpenGL3FixedPipelineRenderer;
|
class COpenGL3FixedPipelineRenderer;
|
||||||
class COpenGL3Renderer2D;
|
class COpenGL3Renderer2D;
|
||||||
|
|
||||||
class COpenGL3Driver : public CNullDriver, public IMaterialRendererServices, public COpenGL3ExtensionHandler
|
class COpenGL3DriverBase : public CNullDriver, public IMaterialRendererServices, public COpenGL3ExtensionHandler
|
||||||
{
|
{
|
||||||
friend class COpenGLCoreTexture<COpenGL3Driver>;
|
friend class COpenGLCoreTexture<COpenGL3DriverBase>;
|
||||||
friend IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! constructor (use createOpenGL3Driver instead)
|
//! constructor (use createOpenGL3Driver instead)
|
||||||
COpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
COpenGL3DriverBase(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! destructor
|
//! destructor
|
||||||
virtual ~COpenGL3Driver();
|
virtual ~COpenGL3DriverBase();
|
||||||
|
|
||||||
virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0), f32 clearDepth = 1.f, u8 clearStencil = 0,
|
virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0), f32 clearDepth = 1.f, u8 clearStencil = 0,
|
||||||
const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0) override;
|
const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0) override;
|
||||||
|
@ -21,7 +21,7 @@ namespace video
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
COpenGL3MaterialRenderer::COpenGL3MaterialRenderer(COpenGL3Driver* driver,
|
COpenGL3MaterialRenderer::COpenGL3MaterialRenderer(COpenGL3DriverBase* driver,
|
||||||
s32& outMaterialTypeNr,
|
s32& outMaterialTypeNr,
|
||||||
const c8* vertexShaderProgram,
|
const c8* vertexShaderProgram,
|
||||||
const c8* pixelShaderProgram,
|
const c8* pixelShaderProgram,
|
||||||
@ -57,7 +57,7 @@ COpenGL3MaterialRenderer::COpenGL3MaterialRenderer(COpenGL3Driver* driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COpenGL3MaterialRenderer::COpenGL3MaterialRenderer(COpenGL3Driver* driver,
|
COpenGL3MaterialRenderer::COpenGL3MaterialRenderer(COpenGL3DriverBase* driver,
|
||||||
IShaderConstantSetCallBack* callback,
|
IShaderConstantSetCallBack* callback,
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
||||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData)
|
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData)
|
||||||
|
@ -18,14 +18,14 @@ namespace irr
|
|||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
class COpenGL3Driver;
|
class COpenGL3DriverBase;
|
||||||
|
|
||||||
class COpenGL3MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
|
class COpenGL3MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
COpenGL3MaterialRenderer(
|
COpenGL3MaterialRenderer(
|
||||||
COpenGL3Driver* driver,
|
COpenGL3DriverBase* driver,
|
||||||
s32& outMaterialTypeNr,
|
s32& outMaterialTypeNr,
|
||||||
const c8* vertexShaderProgram = 0,
|
const c8* vertexShaderProgram = 0,
|
||||||
const c8* pixelShaderProgram = 0,
|
const c8* pixelShaderProgram = 0,
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
COpenGL3MaterialRenderer(COpenGL3Driver* driver,
|
COpenGL3MaterialRenderer(COpenGL3DriverBase* driver,
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
IShaderConstantSetCallBack* callback = 0,
|
||||||
E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
|
E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
|
||||||
s32 userData = 0);
|
s32 userData = 0);
|
||||||
@ -75,7 +75,7 @@ protected:
|
|||||||
bool createShader(GLenum shaderType, const char* shader);
|
bool createShader(GLenum shaderType, const char* shader);
|
||||||
bool linkProgram();
|
bool linkProgram();
|
||||||
|
|
||||||
COpenGL3Driver* Driver;
|
COpenGL3DriverBase* Driver;
|
||||||
IShaderConstantSetCallBack* CallBack;
|
IShaderConstantSetCallBack* CallBack;
|
||||||
|
|
||||||
bool Alpha;
|
bool Alpha;
|
||||||
|
@ -18,7 +18,7 @@ namespace irr
|
|||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
|
|
||||||
COpenGL3Renderer2D::COpenGL3Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COpenGL3Driver* driver, bool withTexture) :
|
COpenGL3Renderer2D::COpenGL3Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COpenGL3DriverBase* driver, bool withTexture) :
|
||||||
COpenGL3MaterialRenderer(driver, 0, EMT_SOLID),
|
COpenGL3MaterialRenderer(driver, 0, EMT_SOLID),
|
||||||
WithTexture(withTexture)
|
WithTexture(withTexture)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace video
|
|||||||
class COpenGL3Renderer2D : public COpenGL3MaterialRenderer
|
class COpenGL3Renderer2D : public COpenGL3MaterialRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
COpenGL3Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COpenGL3Driver* driver, bool withTexture);
|
COpenGL3Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COpenGL3DriverBase* driver, bool withTexture);
|
||||||
~COpenGL3Renderer2D();
|
~COpenGL3Renderer2D();
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
||||||
|
22
source/Irrlicht/OpenGL3/Driver.cpp
Normal file
22
source/Irrlicht/OpenGL3/Driver.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2023 Vitaliy Lobachevskiy
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#include "Driver.h"
|
||||||
|
|
||||||
|
namespace irr {
|
||||||
|
namespace video {
|
||||||
|
|
||||||
|
E_DRIVER_TYPE COpenGL3Driver::getDriverType() const {
|
||||||
|
return EDT_OPENGL3;
|
||||||
|
}
|
||||||
|
|
||||||
|
IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
||||||
|
{
|
||||||
|
COpenGL3Driver* driver = new COpenGL3Driver(params, io, contextManager);
|
||||||
|
driver->genericDriverInit(params.WindowSize, params.Stencilbuffer); // don't call in constructor, it uses virtual function calls of driver
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
source/Irrlicht/OpenGL3/Driver.h
Normal file
19
source/Irrlicht/OpenGL3/Driver.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2023 Vitaliy Lobachevskiy
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "OpenGL/Driver.h"
|
||||||
|
|
||||||
|
namespace irr {
|
||||||
|
namespace video {
|
||||||
|
|
||||||
|
class COpenGL3Driver : public COpenGL3DriverBase {
|
||||||
|
friend IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||||
|
public:
|
||||||
|
using COpenGL3DriverBase::COpenGL3DriverBase;
|
||||||
|
E_DRIVER_TYPE getDriverType() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
22
source/Irrlicht/OpenGLES2/Driver.cpp
Normal file
22
source/Irrlicht/OpenGLES2/Driver.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2023 Vitaliy Lobachevskiy
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#include "Driver.h"
|
||||||
|
|
||||||
|
namespace irr {
|
||||||
|
namespace video {
|
||||||
|
|
||||||
|
E_DRIVER_TYPE COpenGLES2Driver::getDriverType() const {
|
||||||
|
return EDT_OGLES2;
|
||||||
|
}
|
||||||
|
|
||||||
|
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
|
||||||
|
{
|
||||||
|
COpenGLES2Driver* driver = new COpenGLES2Driver(params, io, contextManager);
|
||||||
|
driver->genericDriverInit(params.WindowSize, params.Stencilbuffer); // don't call in constructor, it uses virtual function calls of driver
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
source/Irrlicht/OpenGLES2/Driver.h
Normal file
19
source/Irrlicht/OpenGLES2/Driver.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2023 Vitaliy Lobachevskiy
|
||||||
|
// This file is part of the "Irrlicht Engine".
|
||||||
|
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "OpenGL/Driver.h"
|
||||||
|
|
||||||
|
namespace irr {
|
||||||
|
namespace video {
|
||||||
|
|
||||||
|
class COpenGLES2Driver : public COpenGL3DriverBase {
|
||||||
|
friend IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||||
|
public:
|
||||||
|
using COpenGL3DriverBase::COpenGL3DriverBase;
|
||||||
|
E_DRIVER_TYPE getDriverType() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user