mirror of https://github.com/odrling/Aegisub
Move OpenGL code down into Platform as it's portable now
Originally committed to SVN as r3592.
This commit is contained in:
parent
e0b36fdaff
commit
400365d831
|
@ -181,22 +181,22 @@ public:
|
|||
/// Video card
|
||||
/// @return Video card description
|
||||
/// @retval Any
|
||||
virtual wxString Video()=0;
|
||||
virtual wxString Video();
|
||||
|
||||
/// Video card
|
||||
/// @return Video card vendor
|
||||
/// @retval Any
|
||||
virtual wxString VideoVendor()=0;
|
||||
virtual wxString VideoVendor();
|
||||
|
||||
/// Video card renderer
|
||||
/// @return Video card renderer name
|
||||
/// @retval Any
|
||||
virtual wxString VideoRenderer()=0;
|
||||
virtual wxString VideoRenderer();
|
||||
|
||||
/// Video card version
|
||||
/// @return Video card renderer version
|
||||
/// @retval Any
|
||||
virtual wxString VideoVersion()=0;
|
||||
virtual wxString VideoVersion();
|
||||
//@}
|
||||
|
||||
/// @name Windows
|
||||
|
@ -294,10 +294,20 @@ public:
|
|||
|
||||
private:
|
||||
void Init();
|
||||
void GetVideoInfo();
|
||||
|
||||
/// wxPlatformInfo struct.
|
||||
const wxPlatformInfo plat;
|
||||
|
||||
/// wxLocale instance.
|
||||
wxLocale *locale;
|
||||
|
||||
/// Video vendor
|
||||
wxString vendor;
|
||||
|
||||
/// Video renderer
|
||||
wxString renderer;
|
||||
|
||||
/// Video API/driver version
|
||||
wxString version;
|
||||
};
|
||||
|
|
|
@ -19,9 +19,12 @@
|
|||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/gdicmn.h> // Display* functions.
|
||||
#include <wx/version.h> // Version info.
|
||||
#include <wx/intl.h> // Locale info.
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
|
@ -30,6 +33,16 @@
|
|||
#include "platform_unix_linux.h"
|
||||
#include "platform_unix_osx.h"
|
||||
|
||||
extern "C" {
|
||||
#ifdef __WXMAC__
|
||||
#include "OpenGL/glu.h"
|
||||
#include "OpenGL/gl.h"
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
/// @brief Constructor.
|
||||
Platform* Platform::GetPlatform() {
|
||||
|
||||
|
@ -52,6 +65,26 @@ Platform* Platform::GetPlatform() {
|
|||
void Platform::Init() {
|
||||
locale = new wxLocale();
|
||||
locale->Init();
|
||||
GetVideoInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gather video adapter information via OpenGL
|
||||
*
|
||||
*/
|
||||
void Platform::GetVideoInfo() {
|
||||
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);
|
||||
|
||||
vendor = wxString(glGetString(GL_VENDOR));
|
||||
renderer = wxString(glGetString(GL_RENDERER));
|
||||
version = wxString(glGetString(GL_VERSION));
|
||||
|
||||
delete ctx;
|
||||
delete glc;
|
||||
}
|
||||
|
||||
wxString Platform::ArchName() {
|
||||
|
@ -118,6 +151,22 @@ wxString Platform::DesktopEnvironment() {
|
|||
return "";
|
||||
}
|
||||
|
||||
wxString Platform::Video() {
|
||||
return wxString::Format("%s %s (%s)", vendor, renderer, version);
|
||||
}
|
||||
|
||||
wxString Platform::VideoVendor() {
|
||||
return vendor;
|
||||
}
|
||||
|
||||
wxString Platform::VideoRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
wxString Platform::VideoVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
wxString Platform::PatchLevel() {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <wx/string.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
|
@ -30,39 +29,9 @@
|
|||
|
||||
extern "C" {
|
||||
#include <sys/utsname.h>
|
||||
#ifdef __WXMAC__
|
||||
#include "OpenGL/glu.h"
|
||||
#include "OpenGL/gl.h"
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
PlatformUnix::PlatformUnix() {
|
||||
GetVideoInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gather video adapter information via OpenGL
|
||||
*
|
||||
*/
|
||||
void PlatformUnix::GetVideoInfo() {
|
||||
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);
|
||||
ctx->SetCurrent(glc);
|
||||
|
||||
vendor = wxString(glGetString(GL_VENDOR));
|
||||
renderer = wxString(glGetString(GL_RENDERER));
|
||||
version = wxString(glGetString(GL_VERSION));
|
||||
|
||||
delete ctx;
|
||||
delete glc;
|
||||
}
|
||||
|
||||
wxString PlatformUnix::OSVersion() {
|
||||
struct utsname name;
|
||||
if (uname(&name) != -1) {
|
||||
|
@ -103,22 +72,6 @@ wxString PlatformUnix::Memory() {
|
|||
return "";
|
||||
};
|
||||
|
||||
wxString PlatformUnix::Video() {
|
||||
return wxString::Format("%s %s (%s)", vendor, renderer, version);
|
||||
}
|
||||
|
||||
wxString PlatformUnix::VideoVendor() {
|
||||
return vendor;
|
||||
};
|
||||
|
||||
wxString PlatformUnix::VideoRenderer() {
|
||||
return renderer;
|
||||
};
|
||||
|
||||
wxString PlatformUnix::VideoVersion() {
|
||||
return version;
|
||||
};
|
||||
|
||||
wxString PlatformUnix::UnixLibraries() {
|
||||
return "";
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@ class Platform;
|
|||
/// @brief General Unix functions.
|
||||
class PlatformUnix : public Platform {
|
||||
public:
|
||||
PlatformUnix();
|
||||
PlatformUnix() {};
|
||||
virtual ~PlatformUnix() {};
|
||||
wxString OSVersion();
|
||||
wxString DesktopEnvironment();
|
||||
|
@ -36,17 +36,7 @@ public:
|
|||
virtual wxString CPUFeatures();
|
||||
virtual wxString CPUFeatures2();
|
||||
virtual wxString Memory();
|
||||
virtual wxString Video();
|
||||
virtual wxString VideoVendor();
|
||||
virtual wxString VideoRenderer();
|
||||
virtual wxString VideoVersion();
|
||||
|
||||
// Unix Specific
|
||||
virtual wxString UnixLibraries();
|
||||
|
||||
private:
|
||||
virtual void GetVideoInfo();
|
||||
wxString vendor;
|
||||
wxString renderer;
|
||||
wxString version;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue