Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Revert #225 (d98dc90)
Browse files Browse the repository at this point in the history
Fixes that Windows+SDL builds use the Windows Irrlicht device instead of the SDL Irrlicht device.
  • Loading branch information
grorp authored Oct 4, 2023
1 parent 9954667 commit 5b2f192
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 42 deletions.
7 changes: 5 additions & 2 deletions source/Irrlicht/CEGLManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "CEGLManager.h"

#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_

#include "irrString.h"
#include "irrArray.h"
#include "os.h"
Expand Down Expand Up @@ -42,7 +44,7 @@ bool CEGLManager::initialize(const SIrrlichtCreationParameters& params, const SE
return true;

// Window is depend on platform.
#if defined(_IRR_WINDOWS_API_)
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
EglWindow = (NativeWindowType)Data.OpenGLWin32.HWnd;
Data.OpenGLWin32.HDc = GetDC((HWND)EglWindow);
EglDisplay = eglGetDisplay((NativeDisplayType)Data.OpenGLWin32.HDc);
Expand Down Expand Up @@ -97,7 +99,7 @@ void CEGLManager::terminate()
EglDisplay = EGL_NO_DISPLAY;
}

#if defined(_IRR_WINDOWS_API_)
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
if (Data.OpenGLWin32.HDc)
{
ReleaseDC((HWND)EglWindow, (HDC)Data.OpenGLWin32.HDc);
Expand Down Expand Up @@ -662,3 +664,4 @@ bool CEGLManager::testEGLError()
}
}

#endif
3 changes: 3 additions & 0 deletions source/Irrlicht/CEGLManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#pragma once

#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_

#include <EGL/egl.h>

#include "SIrrCreationParameters.h"
Expand Down Expand Up @@ -109,3 +111,4 @@ namespace video
};
}
}
#endif
2 changes: 2 additions & 0 deletions source/Irrlicht/CIrrDeviceWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h


#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_

#if defined (__STRICT_ANSI__)
#error Compiling with __STRICT_ANSI__ not supported. g++ does set this when compiling with -std=c++11 or -std=c++0x. Use instead -std=gnu++11 or -std=gnu++0x. Or use -U__STRICT_ANSI__ to disable strict ansi.
Expand Down Expand Up @@ -1594,3 +1595,4 @@ core::dimension2di CIrrDeviceWin32::CCursorControl::getSupportedIconSize() const

} // end namespace

#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
4 changes: 4 additions & 0 deletions source/Irrlicht/CIrrDeviceWin32.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#pragma once

#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_

#include "CIrrDeviceStub.h"
#include "IrrlichtDevice.h"

Expand Down Expand Up @@ -423,3 +425,5 @@ namespace irr
};

} // end namespace irr

#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
42 changes: 7 additions & 35 deletions source/Irrlicht/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(SOLARIS TRUE)
endif()

# EGL

set(ENABLE_EGL OFF)

# Device

if(WIN32)
Expand All @@ -96,11 +92,8 @@ elseif(ANDROID)
message(FATAL_ERROR "SDL2 device is not (yet) supported on Android")
endif()
set(DEVICE "ANDROID")
# EGL is required for Android
set(ENABLE_EGL ON)
elseif(EMSCRIPTEN)
add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_)
set(ENABLE_EGL ON)
add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_)
set(LINUX_PLATFORM TRUE)
set(DEVICE "SDL")
elseif(SOLARIS)
Expand Down Expand Up @@ -189,7 +182,7 @@ endif()
if(ENABLE_OPENGL)
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
if(DEVICE STREQUAL "WINDOWS")
add_definitions(-D_IRR_OPENGL_USE_EXTPOINTER_)
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "X11")
add_definitions(-D_IRR_COMPILE_WITH_GLX_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "OSX")
Expand All @@ -213,22 +206,18 @@ if(ENABLE_GLES1)
endif()
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
add_definitions(-D_IRR_OGLES1_USE_EXTPOINTER_)
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
endif()
# We need EGL for GLES1
set(ENABLE_EGL ON)
endif()

if(ENABLE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
add_definitions(-D_IRR_OGLES2_USE_EXTPOINTER_)
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "SDL")
set(USE_SDLGL ON)
set(USE_SDLGLES2 ON)
endif()
# We need EGL for GLES2
set(ENABLE_EGL ON)
endif()

if(ENABLE_WEBGL1)
Expand Down Expand Up @@ -256,7 +245,6 @@ elseif (ENABLE_GLES2)
else()
message(STATUS "OpenGL ES 2: OFF")
endif()
message(STATUS "EGL: ${ENABLE_EGL}")
message(STATUS "WebGL: ${ENABLE_WEBGL1}")

# Required libs
Expand Down Expand Up @@ -368,21 +356,12 @@ add_library(IRROBJ OBJECT
set(IRRDRVROBJ
CNullDriver.cpp
CGLXManager.cpp
CWGLManager.cpp
CEGLManager.cpp
CSDLManager.cpp
mt_opengl_loader.cpp
)

if(WIN32)
set(IRRDRVROBJ ${IRRDRVROBJ}
CIrrDeviceWin32.cpp
)
if(ENABLE_OPENGL)
set(IRRDRVROBJ ${IRRDRVROBJ}
CWGLManager.cpp
)
endif()
endif()

if(ENABLE_OPENGL)
set(IRRDRVROBJ
${IRRDRVROBJ}
Expand All @@ -402,14 +381,6 @@ if(ENABLE_GLES1)
)
endif()


if(ENABLE_EGL)
set(IRRDRVROBJ
${IRRDRVROBJ}
CEGLManager.cpp
)
endif()

set(IRRIMAGEOBJ
CColorConverter.cpp
CImage.cpp
Expand Down Expand Up @@ -473,6 +444,7 @@ add_library(IRROTHEROBJ OBJECT
CIrrDeviceSDL.cpp
CIrrDeviceLinux.cpp
CIrrDeviceStub.cpp
CIrrDeviceWin32.cpp
CLogger.cpp
COSOperator.cpp
Irrlicht.cpp
Expand Down
2 changes: 1 addition & 1 deletion source/Irrlicht/COGLESExtensionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "fast_atof.h"

#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_WINDOWS_API_)
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
#include <EGL/egl.h>
#else
#include <GLES/egl.h>
Expand Down
2 changes: 1 addition & 1 deletion source/Irrlicht/COpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool COpenGLDriver::initDriver()

genericDriverInit();

#if defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
extGlSwapInterval(Params.Vsync ? 1 : 0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion source/Irrlicht/COpenGLExtensionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ inline void COpenGLExtensionHandler::extGlGenerateTextureMipmap(GLuint texture,
inline void COpenGLExtensionHandler::extGlSwapInterval(int interval)
{
// we have wglext, so try to use that
#if defined(_IRR_WINDOWS_API_)
#if defined(_IRR_WINDOWS_API_) && defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
#ifdef WGL_EXT_swap_control
if (pWglSwapIntervalEXT)
pWglSwapIntervalEXT(interval);
Expand Down
4 changes: 4 additions & 0 deletions source/Irrlicht/CWGLManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "CWGLManager.h"

#ifdef _IRR_COMPILE_WITH_WGL_MANAGER_

#include "os.h"

#include <GL/gl.h>
Expand Down Expand Up @@ -505,3 +507,5 @@ bool CWGLManager::swapBuffers()

}
}

#endif
4 changes: 4 additions & 0 deletions source/Irrlicht/CWGLManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#pragma once

#ifdef _IRR_COMPILE_WITH_WGL_MANAGER_

#include "SIrrCreationParameters.h"
#include "SExposedVideoData.h"
#include "IContextManager.h"
Expand Down Expand Up @@ -70,3 +72,5 @@ namespace video
};
}
}

#endif
4 changes: 2 additions & 2 deletions source/Irrlicht/Irrlicht.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2017 Nikolaus Geb
#endif

#include "irrlicht.h"
#ifdef _IRR_WINDOWS_API_
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
#include "CIrrDeviceWin32.h"
#endif

Expand Down Expand Up @@ -60,7 +60,7 @@ namespace irr

IrrlichtDevice* dev = 0;

#ifdef _IRR_WINDOWS_API_
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
if (params.DeviceType == EIDT_WIN32 || (!dev && params.DeviceType == EIDT_BEST))
dev = new CIrrDeviceWin32(params);
#endif
Expand Down

0 comments on commit 5b2f192

Please sign in to comment.