diff --git a/openrct2.vcxproj b/openrct2.vcxproj
index a93969114f..5f2f90147a 100644
--- a/openrct2.vcxproj
+++ b/openrct2.vcxproj
@@ -42,6 +42,7 @@
+
@@ -336,6 +337,7 @@
+
diff --git a/src/drawing/engines/OpenGLAPI.cpp b/src/drawing/engines/OpenGLAPI.cpp
new file mode 100644
index 0000000000..2f71a24692
--- /dev/null
+++ b/src/drawing/engines/OpenGLAPI.cpp
@@ -0,0 +1,73 @@
+#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
+/*****************************************************************************
+ * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+ *
+ * OpenRCT2 is the work of many authors, a full list can be found in contributors.md
+ * For more information, visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * A full copy of the GNU General Public License can be found in licence.txt
+ *****************************************************************************/
+#pragma endregion
+
+#include
+
+#define NO_EXTERN_GLAPI
+#include "OpenGLAPI.h"
+
+#if __WINDOWS__
+
+#include
+
+#include "../../core/Console.hpp"
+
+#pragma comment(lib, "opengl32.lib")
+
+template
+static inline bool SetProc(T * func, const char * name)
+{
+ T address = (T)SDL_GL_GetProcAddress(name);
+ if (address == nullptr)
+ {
+ return false;
+ }
+
+ *func = address;
+ return true;
+}
+
+#define SetupOpenGLFunction(func) \
+ { \
+ if (!SetProc(&func, "" #func "")) \
+ { \
+ return "" #func ""; \
+ } \
+ }
+
+static const char * TryLoadAllProcAddresses()
+{
+ SetupOpenGLFunction(glCreateShader);
+ SetupOpenGLFunction(glDeleteShader);
+
+ return nullptr;
+}
+
+#endif /* __WINDOWS__ */
+
+bool OpenGLAPI::Initialise()
+{
+#if __WINDOWS__
+ const char * failedProcName = TryLoadAllProcAddresses();
+ if (failedProcName != nullptr)
+ {
+ Console::Error::WriteFormat("Failed to load %s.\n", failedProcName);
+ return false;
+ }
+#endif
+ return true;
+}
+
diff --git a/src/drawing/engines/OpenGLAPI.h b/src/drawing/engines/OpenGLAPI.h
new file mode 100644
index 0000000000..9bb8962992
--- /dev/null
+++ b/src/drawing/engines/OpenGLAPI.h
@@ -0,0 +1,39 @@
+#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
+/*****************************************************************************
+ * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+ *
+ * OpenRCT2 is the work of many authors, a full list can be found in contributors.md
+ * For more information, visit https://github.com/OpenRCT2/OpenRCT2
+ *
+ * OpenRCT2 is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * A full copy of the GNU General Public License can be found in licence.txt
+ *****************************************************************************/
+#pragma endregion
+
+#pragma once
+
+#include
+
+#if __WINDOWS__
+
+#ifdef NO_EXTERN_GLAPI
+ #define GLAPI_DECL
+ #define GLAPI_SET = nullptr
+#else
+ #define GLAPI_DECL extern
+ #define GLAPI_SET
+#endif
+
+GLAPI_DECL PFNGLCREATESHADERPROC glCreateShader GLAPI_SET;
+GLAPI_DECL PFNGLDELETESHADERPROC glDeleteShader GLAPI_SET;
+
+#endif /* __WINDOWS__ */
+
+namespace OpenGLAPI
+{
+ bool Initialise();
+}
diff --git a/src/drawing/engines/OpenGLDrawingEngine.cpp b/src/drawing/engines/OpenGLDrawingEngine.cpp
index 7346256b0c..a430de5d78 100644
--- a/src/drawing/engines/OpenGLDrawingEngine.cpp
+++ b/src/drawing/engines/OpenGLDrawingEngine.cpp
@@ -18,13 +18,9 @@
#include
#include
-#ifdef __WINDOWS__
- #include
- #pragma comment(lib, "opengl32.lib")
-#endif
-
-#include
+#include "OpenGLAPI.h"
+#include "../../core/Exception.hpp"
#include "../../core/Math.hpp"
#include "../../core/Memory.hpp"
#include "../IDrawingContext.h"
@@ -131,6 +127,11 @@ public:
_context = SDL_GL_CreateContext(_window);
SDL_GL_MakeCurrent(_window, _context);
+ if (!OpenGLAPI::Initialise())
+ {
+ throw Exception("Unable to initialise OpenGL.");
+ }
+
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}