|
@@ -25,9 +25,12 @@
|
|
#include "Shader.h"
|
|
#include "Shader.h"
|
|
#include "common/Exception.h"
|
|
#include "common/Exception.h"
|
|
|
|
|
|
-// STL
|
|
|
|
|
|
+// C++
|
|
#include <algorithm>
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
+// C
|
|
|
|
+#include <cstring>
|
|
|
|
+
|
|
namespace love
|
|
namespace love
|
|
{
|
|
{
|
|
namespace graphics
|
|
namespace graphics
|
|
@@ -39,6 +42,7 @@ OpenGL::OpenGL()
|
|
: contextInitialized(false)
|
|
: contextInitialized(false)
|
|
, maxAnisotropy(1.0f)
|
|
, maxAnisotropy(1.0f)
|
|
, maxTextureSize(0)
|
|
, maxTextureSize(0)
|
|
|
|
+ , vendor(VENDOR_UNKNOWN)
|
|
, state()
|
|
, state()
|
|
{
|
|
{
|
|
}
|
|
}
|
|
@@ -118,6 +122,29 @@ void OpenGL::deInitContext()
|
|
contextInitialized = false;
|
|
contextInitialized = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void OpenGL::initVendor()
|
|
|
|
+{
|
|
|
|
+ const char *vstr = (const char *) glGetString(GL_VENDOR);
|
|
|
|
+ if (!vstr)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ // http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR
|
|
|
|
+ if (strstr(vstr, "ATI Technologies"))
|
|
|
|
+ vendor = VENDOR_ATI_AMD;
|
|
|
|
+ else if (strstr(vstr, "NVIDIA"))
|
|
|
|
+ vendor = VENDOR_NVIDIA;
|
|
|
|
+ else if (strstr(vstr, "Intel"))
|
|
|
|
+ vendor = VENDOR_INTEL;
|
|
|
|
+ else if (strstr(vstr, "Mesa"))
|
|
|
|
+ vendor = VENDOR_MESA_SOFT;
|
|
|
|
+ else if (strstr(vstr, "Apple Computer"))
|
|
|
|
+ vendor = VENDOR_APPLE;
|
|
|
|
+ else if (strstr(vstr, "Microsoft"))
|
|
|
|
+ vendor = VENDOR_MICROSOFT;
|
|
|
|
+ else
|
|
|
|
+ vendor = VENDOR_UNKNOWN;
|
|
|
|
+}
|
|
|
|
+
|
|
void OpenGL::initOpenGLFunctions()
|
|
void OpenGL::initOpenGLFunctions()
|
|
{
|
|
{
|
|
// The functionality of the core and ARB VBOs are identical, so we can
|
|
// The functionality of the core and ARB VBOs are identical, so we can
|
|
@@ -461,6 +488,11 @@ int OpenGL::getMaxTextureSize() const
|
|
return maxTextureSize;
|
|
return maxTextureSize;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+OpenGL::Vendor OpenGL::getVendor() const
|
|
|
|
+{
|
|
|
|
+ return vendor;
|
|
|
|
+}
|
|
|
|
+
|
|
// OpenGL class instance singleton.
|
|
// OpenGL class instance singleton.
|
|
OpenGL gl;
|
|
OpenGL gl;
|
|
|
|
|