Cache wxGL* values to speed up GL probes, also delete locale in ~Platform().

Originally committed to SVN as r5120.
This commit is contained in:
Amar Takhar 2011-01-03 16:14:43 +00:00
parent 99aff7254f
commit 4d3c89eebf
2 changed files with 19 additions and 8 deletions

View file

@ -34,7 +34,7 @@ public:
Platform() {};
/// Destructor
virtual ~Platform() {};
~Platform();
/// Get platform instance.
static Platform* GetPlatform();
@ -290,6 +290,11 @@ private:
/// wxLocale instance.
wxLocale *locale;
/// wxGLCanvas.
wxGLCanvas *glc;
/// wxGLContext.
wxGLContext *ctx;
/// Available video information.
enum VideoInfo {

View file

@ -70,6 +70,19 @@ Platform* Platform::GetPlatform() {
void Platform::Init() {
locale = new wxLocale();
locale->Init();
int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxSize(0,0));
ctx = new wxGLContext(glc, 0);
wxGLCanvas &cr = *glc;
ctx->SetCurrent(cr);
}
Platform::~Platform() {
delete ctx;
delete glc;
delete locale;
}
/**
@ -77,11 +90,6 @@ void Platform::Init() {
*
*/
std::string Platform::GetVideoInfo(enum Platform::VideoInfo which) {
int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
wxGLCanvas *glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxDefaultSize);
wxGLContext *ctx = new wxGLContext(glc, 0);
wxGLCanvas &cr = *glc;
ctx->SetCurrent(cr);
wxString value;
@ -101,8 +109,6 @@ std::string Platform::GetVideoInfo(enum Platform::VideoInfo which) {
return "";
}
delete ctx;
delete glc;
}
std::string Platform::ArchName() {