diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-02-21 22:17:11 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | b4a3bc1ffe5e1692ab5a53ac936ac67b256be621 (patch) | |
tree | 543adb743164173c6bcd4e5ae71950d7c0085226 /src/video | |
parent | 7f55f0a264aa6070865ac311942c3bbf7f1e1319 (diff) | |
download | openttd-b4a3bc1ffe5e1692ab5a53ac936ac67b256be621.tar.xz |
Codechange: [OpenGL] Separate context state setup from general init.
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/opengl.cpp | 11 | ||||
-rw-r--r-- | src/video/opengl.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index 87ce8b7f3..4a22744cc 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -621,14 +621,19 @@ const char *OpenGLBackend::Init() /* Create resources for sprite rendering. */ if (!OpenGLSprite::Create()) return "Failed to create sprite rendering resources"; + this->PrepareContext(); + (void)glGetError(); // Clear errors. + + return nullptr; +} + +void OpenGLBackend::PrepareContext() +{ glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glDisable(GL_DEPTH_TEST); /* Enable alpha blending using the src alpha factor. */ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - (void)glGetError(); // Clear errors. - - return nullptr; } /** diff --git a/src/video/opengl.h b/src/video/opengl.h index d910ca3bf..86c0b0d17 100644 --- a/src/video/opengl.h +++ b/src/video/opengl.h @@ -73,6 +73,8 @@ public: static const char *Create(GetOGLProcAddressProc get_proc); static void Destroy(); + void PrepareContext(); + void UpdatePalette(const Colour *pal, uint first, uint length); bool Resize(int w, int h, bool force = false); void Paint(); |