diff --git a/include/Spectre/GfxDriver/GfxDriver.h b/include/Spectre/GfxDriver/GfxDriver.h index 3ddb730..d6b331f 100644 --- a/include/Spectre/GfxDriver/GfxDriver.h +++ b/include/Spectre/GfxDriver/GfxDriver.h @@ -14,8 +14,16 @@ public: }; public: + // Get the name of the driver. + virtual std::string getName() const = 0; + + // Get the version of the driver + virtual std::string getVersion() const = 0; + virtual std::string getVendor() const = 0; + virtual std::string getCardName() const = 0; + virtual void setViewport(int x, int y, int width, int height) = 0; virtual void setClearColor(float r, float g, float b, float a) = 0; @@ -25,10 +33,10 @@ public: virtual void clearColorBuffer() = 0; // Resources. - + // CreateIndexBuffer() // CreateVertexBuffer() - + // Draw calls }; diff --git a/source/GfxDriver/OpenGL/OpenGLDrv.cpp b/source/GfxDriver/OpenGL/OpenGLDrv.cpp index ead2e2a..f313608 100644 --- a/source/GfxDriver/OpenGL/OpenGLDrv.cpp +++ b/source/GfxDriver/OpenGL/OpenGLDrv.cpp @@ -4,14 +4,14 @@ namespace sp { -std::string OpenGLDrv::getVendor() const -{ - char buf[512]; +std::string OpenGLDrv::getName() const { + return "OpenGL"; +} +std::string OpenGLDrv::getVersion() const { + + char buf[512]; std::string prof = "Compability"; - char *ver = (char*) glGetString(GL_VERSION); - char *ven = (char*) glGetString(GL_VENDOR); - char *ren = (char*) glGetString(GL_RENDERER); GLint flags; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &flags); @@ -19,11 +19,21 @@ std::string OpenGLDrv::getVendor() const prof = "Core"; } - snprintf(buf, sizeof(buf), "OpenGL %s %s profile - %s %s", ver, prof.c_str(), ren, ven); + snprintf(buf, sizeof(buf), "%s %s", prof.c_str(), glGetString(GL_VERSION)); return std::string(buf); } +std::string OpenGLDrv::getVendor() const +{ + return std::string((char*)glGetString(GL_VENDOR)); +} + +std::string OpenGLDrv::getCardName() const +{ + return std::string((char*)glGetString(GL_RENDERER)); +} + void OpenGLDrv::setViewport(int x, int y, int width, int height) { glViewport(x, y, width, height); diff --git a/source/GfxDriver/OpenGL/OpenGLDrv.h b/source/GfxDriver/OpenGL/OpenGLDrv.h index c993fb0..583d695 100644 --- a/source/GfxDriver/OpenGL/OpenGLDrv.h +++ b/source/GfxDriver/OpenGL/OpenGLDrv.h @@ -9,8 +9,14 @@ namespace sp { class OpenGLDrv : public GfxDriver { public: + virtual std::string getName() const; + + virtual std::string getVersion() const; + virtual std::string getVendor() const; + virtual std::string getCardName() const; + virtual void setViewport(int x, int y, int width, int height); virtual void setClearColor(float r, float g, float b, float a);