Graphics class: use GfxDriver API.
This commit is contained in:
parent
d3debea41a
commit
4dad1a5d75
2 changed files with 14 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "GfxDriver/OpenGL/OpenGLDrv.h"
|
||||
#include <Spectre/Graphics.h>
|
||||
#include <Graphics/GL/gl.h>
|
||||
#include <string>
|
||||
|
||||
namespace sp {
|
||||
|
|
@ -11,6 +11,9 @@ Graphics::Graphics(PlatformApplication *platform)
|
|||
m_height = 600;
|
||||
|
||||
m_display = new Display();
|
||||
|
||||
// Only have OpenGL atm.
|
||||
m_gfxdrv = new OpenGLDrv();
|
||||
}
|
||||
|
||||
Graphics::~Graphics()
|
||||
|
|
@ -42,22 +45,7 @@ void Graphics::shutdown()
|
|||
|
||||
std::string Graphics::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);
|
||||
if (flags & GL_CONTEXT_CORE_PROFILE_BIT) {
|
||||
prof = "Core";
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "OpenGL %s %s profile - %s %s", ver, prof.c_str(), ren, ven);
|
||||
|
||||
return std::string(buf);
|
||||
return m_gfxdrv->getVendor();
|
||||
}
|
||||
|
||||
void Graphics::setDisplayMode(Display::Mode mode)
|
||||
|
|
@ -72,17 +60,17 @@ void Graphics::setSize(int width, int height)
|
|||
|
||||
void Graphics::setViewport(int x, int y, int width, int height)
|
||||
{
|
||||
glViewport(x, y, width, height);
|
||||
m_gfxdrv->setViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
void Graphics::setClearColor(float r, float g, float b)
|
||||
{
|
||||
glClearColor(r, g, b, 1.0f);
|
||||
m_gfxdrv->setClearColor(r, g, b, 1.0f);
|
||||
}
|
||||
|
||||
void Graphics::clearBuffer()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
m_gfxdrv->clearColorBuffer();
|
||||
}
|
||||
|
||||
void Graphics::swapBuffers()
|
||||
Loading…
Add table
Add a link
Reference in a new issue