forked from mia/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
4 changed files with 64 additions and 62 deletions
|
@ -181,22 +181,22 @@ public:
|
||||||
/// Video card
|
/// Video card
|
||||||
/// @return Video card description
|
/// @return Video card description
|
||||||
/// @retval Any
|
/// @retval Any
|
||||||
virtual wxString Video()=0;
|
virtual wxString Video();
|
||||||
|
|
||||||
/// Video card
|
/// Video card
|
||||||
/// @return Video card vendor
|
/// @return Video card vendor
|
||||||
/// @retval Any
|
/// @retval Any
|
||||||
virtual wxString VideoVendor()=0;
|
virtual wxString VideoVendor();
|
||||||
|
|
||||||
/// Video card renderer
|
/// Video card renderer
|
||||||
/// @return Video card renderer name
|
/// @return Video card renderer name
|
||||||
/// @retval Any
|
/// @retval Any
|
||||||
virtual wxString VideoRenderer()=0;
|
virtual wxString VideoRenderer();
|
||||||
|
|
||||||
/// Video card version
|
/// Video card version
|
||||||
/// @return Video card renderer version
|
/// @return Video card renderer version
|
||||||
/// @retval Any
|
/// @retval Any
|
||||||
virtual wxString VideoVersion()=0;
|
virtual wxString VideoVersion();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// @name Windows
|
/// @name Windows
|
||||||
|
@ -294,10 +294,20 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
void GetVideoInfo();
|
||||||
|
|
||||||
/// wxPlatformInfo struct.
|
/// wxPlatformInfo struct.
|
||||||
const wxPlatformInfo plat;
|
const wxPlatformInfo plat;
|
||||||
|
|
||||||
/// wxLocale instance.
|
/// wxLocale instance.
|
||||||
wxLocale *locale;
|
wxLocale *locale;
|
||||||
|
|
||||||
|
/// Video vendor
|
||||||
|
wxString vendor;
|
||||||
|
|
||||||
|
/// Video renderer
|
||||||
|
wxString renderer;
|
||||||
|
|
||||||
|
/// Video API/driver version
|
||||||
|
wxString version;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,9 +19,12 @@
|
||||||
/// @ingroup base
|
/// @ingroup base
|
||||||
|
|
||||||
#ifndef R_PRECOMP
|
#ifndef R_PRECOMP
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/app.h>
|
||||||
#include <wx/gdicmn.h> // Display* functions.
|
#include <wx/gdicmn.h> // Display* functions.
|
||||||
#include <wx/version.h> // Version info.
|
#include <wx/version.h> // Version info.
|
||||||
#include <wx/intl.h> // Locale info.
|
#include <wx/intl.h> // Locale info.
|
||||||
|
#include <wx/glcanvas.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "include/platform.h"
|
#include "include/platform.h"
|
||||||
|
@ -30,6 +33,16 @@
|
||||||
#include "platform_unix_linux.h"
|
#include "platform_unix_linux.h"
|
||||||
#include "platform_unix_osx.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.
|
/// @brief Constructor.
|
||||||
Platform* Platform::GetPlatform() {
|
Platform* Platform::GetPlatform() {
|
||||||
|
|
||||||
|
@ -52,6 +65,26 @@ Platform* Platform::GetPlatform() {
|
||||||
void Platform::Init() {
|
void Platform::Init() {
|
||||||
locale = new wxLocale();
|
locale = new wxLocale();
|
||||||
locale->Init();
|
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() {
|
wxString Platform::ArchName() {
|
||||||
|
@ -118,6 +151,22 @@ wxString Platform::DesktopEnvironment() {
|
||||||
return "";
|
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__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
wxString Platform::PatchLevel() {
|
wxString Platform::PatchLevel() {
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/apptrait.h>
|
#include <wx/apptrait.h>
|
||||||
#include <wx/glcanvas.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "include/platform.h"
|
#include "include/platform.h"
|
||||||
|
@ -30,39 +29,9 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <sys/utsname.h>
|
#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() {
|
wxString PlatformUnix::OSVersion() {
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
if (uname(&name) != -1) {
|
if (uname(&name) != -1) {
|
||||||
|
@ -103,22 +72,6 @@ wxString PlatformUnix::Memory() {
|
||||||
return "";
|
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() {
|
wxString PlatformUnix::UnixLibraries() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Platform;
|
||||||
/// @brief General Unix functions.
|
/// @brief General Unix functions.
|
||||||
class PlatformUnix : public Platform {
|
class PlatformUnix : public Platform {
|
||||||
public:
|
public:
|
||||||
PlatformUnix();
|
PlatformUnix() {};
|
||||||
virtual ~PlatformUnix() {};
|
virtual ~PlatformUnix() {};
|
||||||
wxString OSVersion();
|
wxString OSVersion();
|
||||||
wxString DesktopEnvironment();
|
wxString DesktopEnvironment();
|
||||||
|
@ -36,17 +36,7 @@ public:
|
||||||
virtual wxString CPUFeatures();
|
virtual wxString CPUFeatures();
|
||||||
virtual wxString CPUFeatures2();
|
virtual wxString CPUFeatures2();
|
||||||
virtual wxString Memory();
|
virtual wxString Memory();
|
||||||
virtual wxString Video();
|
|
||||||
virtual wxString VideoVendor();
|
|
||||||
virtual wxString VideoRenderer();
|
|
||||||
virtual wxString VideoVersion();
|
|
||||||
|
|
||||||
// Unix Specific
|
// Unix Specific
|
||||||
virtual wxString UnixLibraries();
|
virtual wxString UnixLibraries();
|
||||||
|
|
||||||
private:
|
|
||||||
virtual void GetVideoInfo();
|
|
||||||
wxString vendor;
|
|
||||||
wxString renderer;
|
|
||||||
wxString version;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue