initial commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#include "HydraRenderer.h"
|
||||
#include "../GlewIncludes.h"
|
||||
#include "../windowmanager/HydraWindowManager.h"
|
||||
#include "../engine/HydraEngine.h"
|
||||
|
||||
#include <GLMIncludes.h>
|
||||
|
||||
void GLAPIENTRY MessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
||||
{
|
||||
std::cout << "[OpenGL Error](" << type << ") " << message << std::endl;
|
||||
}
|
||||
|
||||
void HydraRenderer::Initialise(HydraRenderSettings render_settings)
|
||||
{
|
||||
m_render_settings = render_settings;
|
||||
glewExperimental = GL_TRUE;
|
||||
GLenum res = glewInit();
|
||||
if (res != GLEW_OK)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
glCullFace(GL_BACK);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glfwSwapInterval(1);
|
||||
glDebugMessageCallback(MessageCallback, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void HydraRenderer::BeginFrame()
|
||||
{
|
||||
|
||||
glViewport(0, 0, m_render_settings.ViewportWidth, m_render_settings.ViewportHeight);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glClearColor(0.0f, 0.5f, 0.7f, 1.0f);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
}
|
||||
|
||||
void HydraRenderer::EndFrame()
|
||||
{
|
||||
HydraWindowManager* window_manager = GetEngine()->WindowManager();
|
||||
window_manager->Swap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user