First render.
This commit is contained in:
@ -7,14 +7,15 @@
|
||||
#include "assert/assertgl.hpp"
|
||||
#include "assert/assert.hpp"
|
||||
#include "game/Game.hpp"
|
||||
#include "display/RenderPipeline.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
RenderHost::RenderHost() {
|
||||
RenderHost::RenderHost() : IRenderHost() {
|
||||
|
||||
}
|
||||
|
||||
void RenderHost::init(std::shared_ptr<Game> game) {
|
||||
void RenderHost::init(const std::shared_ptr<Game> game) {
|
||||
// Init GLFW
|
||||
if(!glfwInit()) {
|
||||
assertUnreachable("Failed to initialize GLFW!");
|
||||
@ -80,10 +81,30 @@ void RenderHost::init(std::shared_ptr<Game> game) {
|
||||
// });
|
||||
}
|
||||
|
||||
void RenderHost::update() {
|
||||
void RenderHost::update(const std::shared_ptr<Game> game) {
|
||||
|
||||
|
||||
// Prepare the initial values
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
assertNoGLError();
|
||||
glBlendFuncSeparate(
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA,
|
||||
GL_ONE,
|
||||
GL_ONE_MINUS_SRC_ALPHA
|
||||
);
|
||||
assertNoGLError();
|
||||
glDepthMask(GL_TRUE);
|
||||
assertNoGLError();
|
||||
glDepthFunc(GL_LESS);
|
||||
assertNoGLError();
|
||||
|
||||
// Pipeline
|
||||
renderPipeline.render(game);
|
||||
|
||||
// Tick the engine.
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
|
||||
// Update events
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace Dawn {
|
||||
*/
|
||||
RenderHost();
|
||||
|
||||
void init(std::shared_ptr<Game> game) override;
|
||||
void update() override;
|
||||
void init(const std::shared_ptr<Game> game) override;
|
||||
void update(const std::shared_ptr<Game> game) override;
|
||||
bool_t isCloseRequested() override;
|
||||
std::shared_ptr<RenderTarget> getBackBufferRenderTarget() override;
|
||||
|
||||
|
Reference in New Issue
Block a user