mirror of https://github.com/OpenTTD/OpenTTD
Codechange: [OpenGL] Separate context state setup from general init.
parent
7f55f0a264
commit
b4a3bc1ffe
|
@ -621,14 +621,19 @@ const char *OpenGLBackend::Init()
|
||||||
/* Create resources for sprite rendering. */
|
/* Create resources for sprite rendering. */
|
||||||
if (!OpenGLSprite::Create()) return "Failed to create sprite rendering resources";
|
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);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
/* Enable alpha blending using the src alpha factor. */
|
/* Enable alpha blending using the src alpha factor. */
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
(void)glGetError(); // Clear errors.
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,6 +73,8 @@ public:
|
||||||
static const char *Create(GetOGLProcAddressProc get_proc);
|
static const char *Create(GetOGLProcAddressProc get_proc);
|
||||||
static void Destroy();
|
static void Destroy();
|
||||||
|
|
||||||
|
void PrepareContext();
|
||||||
|
|
||||||
void UpdatePalette(const Colour *pal, uint first, uint length);
|
void UpdatePalette(const Colour *pal, uint first, uint length);
|
||||||
bool Resize(int w, int h, bool force = false);
|
bool Resize(int w, int h, bool force = false);
|
||||||
void Paint();
|
void Paint();
|
||||||
|
|
Loading…
Reference in New Issue