#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_switches.h"
+#include "ui/gl/gl_version_info.h"
namespace gfx {
return std::string(ext ? ext : "");
}
+std::string GLContext::GetGLVersion() {
+ DCHECK(IsCurrent(NULL));
+ const char *version =
+ reinterpret_cast<const char*>(glGetString(GL_VERSION));
+ return std::string(version ? version : "");
+}
+
+std::string GLContext::GetGLRenderer() {
+ DCHECK(IsCurrent(NULL));
+ const char *renderer =
+ reinterpret_cast<const char*>(glGetString(GL_RENDERER));
+ return std::string(renderer ? renderer : "");
+}
+
bool GLContext::HasExtension(const char* name) {
std::string extensions = GetExtensions();
extensions += " ";
return extensions.find(delimited_name) != std::string::npos;
}
+const GLVersionInfo* GLContext::GetVersionInfo() {
+ if(!version_info_) {
+ std::string version = GetGLVersion();
+ std::string renderer = GetGLRenderer();
+ version_info_ = scoped_ptr<GLVersionInfo>(
+ new GLVersionInfo(version.c_str(), renderer.c_str()));
+ }
+ return version_info_.get();
+}
+
GLShareGroup* GLContext::share_group() {
return share_group_.get();
}
return false;
}
-bool GLContext::InitializeExtensionBindings() {
+bool GLContext::InitializeDynamicBindings() {
DCHECK(IsCurrent(NULL));
static bool initialized = false;
if (initialized)
return initialized;
- initialized = InitializeGLExtensionBindings(GetGLImplementation(), this);
+ initialized = InitializeDynamicGLBindings(GetGLImplementation(), this);
if (!initialized)
- LOG(ERROR) << "Could not initialize extension bindings.";
+ LOG(ERROR) << "Could not initialize dynamic bindings.";
return initialized;
}