Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
66
source/GraphicsOpenGL.cpp
Normal file
66
source/GraphicsOpenGL.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
#include <Spectre/Graphics.h>
|
||||
#include <Spectre/Graphics/OpenGL.h>
|
||||
|
||||
Graphics::Graphics(PlatformApplication *platform)
|
||||
{
|
||||
m_width = 800;
|
||||
m_height = 600;
|
||||
|
||||
m_display = new Display();
|
||||
}
|
||||
|
||||
Graphics::~Graphics()
|
||||
{
|
||||
shutdown();
|
||||
delete m_display;
|
||||
}
|
||||
|
||||
bool Graphics::init()
|
||||
{
|
||||
DisplayMode mode(m_width, m_height);
|
||||
DisplayDescription desc(mode);
|
||||
|
||||
desc.decoration = DisplayDecorate::Menu | DisplayDecorate::Close | DisplayDecorate::Resize;
|
||||
|
||||
m_display->create(desc);
|
||||
|
||||
setClearColor(0.0f, 0.0f, 0.0f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Graphics::shutdown()
|
||||
{
|
||||
m_display->destroy();
|
||||
}
|
||||
|
||||
void Graphics::setDisplayMode(Display::Mode mode)
|
||||
{
|
||||
m_display->setVideoMode(mode);
|
||||
}
|
||||
|
||||
void Graphics::setSize(int width, int height)
|
||||
{
|
||||
m_display->setSize(width, height);
|
||||
}
|
||||
|
||||
void Graphics::setViewport(int x, int y, int width, int height)
|
||||
{
|
||||
glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
void Graphics::setClearColor(float r, float g, float b)
|
||||
{
|
||||
glClearColor(r, g, b, 1.0f);
|
||||
}
|
||||
|
||||
void Graphics::clearBuffer()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void Graphics::swapBuffers()
|
||||
{
|
||||
m_display->swapBuffers();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue