forked from 0ad/0ad
Fixes Atlas on Linux with SDL2 by reordering OpenGL init, based on patch by yashi, fixes #2847
This was SVN commit r16356.
This commit is contained in:
parent
6b364ad240
commit
d644845ae5
@ -521,6 +521,7 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
|
||||
// Need to make sure the canvas is realised, so that its context is valid
|
||||
// this solves the "invalid drawable" error
|
||||
Show(true);
|
||||
Raise();
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
// TODO: wxSafeYield causes issues on wxOSX 2.9, is it necessary?
|
||||
@ -529,6 +530,8 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent)
|
||||
|
||||
// Send setup messages to game engine:
|
||||
|
||||
POST_MESSAGE(InitSDL, ());
|
||||
|
||||
POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas),
|
||||
canvas->GetClientSize().GetWidth(), canvas->GetClientSize().GetHeight()));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2014 Wildfire Games.
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -62,11 +62,10 @@ MESSAGEHANDLER(Init)
|
||||
g_VideoMode.InitNonSDL();
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(InitGraphics)
|
||||
MESSAGEHANDLER(InitSDL)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
#if OS_UNIX || (OS_WIN && !CONFIG2_WSDL)
|
||||
// When using GLX (Linux), SDL has to load the GL library to find
|
||||
// glXGetProcAddressARB before it can load any extensions.
|
||||
// When running in Atlas, we skip the SDL video initialisation code
|
||||
@ -80,7 +79,11 @@ MESSAGEHANDLER(InitGraphics)
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_GL_LoadLibrary(NULL); // NULL = use default
|
||||
// (it shouldn't hurt if this is called multiple times, I think)
|
||||
#endif
|
||||
}
|
||||
|
||||
MESSAGEHANDLER(InitGraphics)
|
||||
{
|
||||
UNUSED2(msg);
|
||||
|
||||
ogl_Init();
|
||||
|
||||
|
@ -32,6 +32,9 @@
|
||||
// Initialise some engine code. Must be called before anything else.
|
||||
MESSAGE(Init, );
|
||||
|
||||
// Initialise SDL-related code. Must be called before SetCanvas and InitGraphics.
|
||||
MESSAGE(InitSDL, );
|
||||
|
||||
// Initialise graphics-related code. Must be called after the first SetCanvas,
|
||||
// and before much else.
|
||||
MESSAGE(InitGraphics, );
|
||||
|
Loading…
Reference in New Issue
Block a user