summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/os_osx.h5
-rw-r--r--platform/osx/os_osx.mm29
2 files changed, 28 insertions, 6 deletions
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index aa8db8f300..04463a81f0 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -50,6 +50,11 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+enum VideoDriver {
+ VIDEO_DRIVER_GLES3,
+ VIDEO_DRIVER_GLES2
+};
+
class OS_OSX : public OS_Unix {
public:
struct KeyEvent {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6e42eb58bd..901232bc50 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -31,6 +31,7 @@
#include "os_osx.h"
#include "dir_access_osx.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
#include "os/keyboard.h"
@@ -992,12 +993,19 @@ void OS_OSX::set_ime_position(const Point2 &p_pos) {
}
int OS_OSX::get_video_driver_count() const {
- return 1;
+
+ return 2;
}
const char *OS_OSX::get_video_driver_name(int p_driver) const {
- return "GLES3";
+ switch (p_driver) {
+ case VIDEO_DRIVER_GLES2:
+ return "GLES2";
+ case VIDEO_DRIVER_GLES3:
+ default:
+ return "GLES3";
+ }
}
void OS_OSX::initialize_core() {
@@ -1111,8 +1119,12 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ADD_ATTR(NSOpenGLPFADoubleBuffer);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
- //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
- ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy);
+ } else {
+ //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+ }
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
@@ -1174,8 +1186,13 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::add_driver(&audio_driver);
// only opengl support here...
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ }
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {