charcoal/OpenGLEngine/ImageScene.cpp
elipzer b7456401e0 Almost able to render the image
Added image scene to render an image in a scene. There is also now
a testing image that is an uber meme. Currently the problem is
that the spritebatch cannot use the offsetof macro because it is a
templated class. Possible solutions to this are changing it to be
specifyable or implemented per vertex type as the other batches
have been.
2018-10-09 11:42:17 -04:00

49 lines
854 B
C++

#include "TexturedScene.h"
#include "stdafx.h"
#include "GLUtil.h"
#include "MeshFactory.h"
namespace charcoal
{
namespace builtin
{
namespace textured
{
void Scene::init()
{
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
{
Batch& batch = *iter;
batch.init();
add_prerenderable(&batch);
}
}
void Scene::use()
{
// TODO: move to glutil
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
}
void Scene::unuse()
{
}
void Scene::render()
{
glutil::clear_screen();
m_shader_program.use();
glutil::uniform_matrix(0, m_p_camera->get_world_to_view_matrix());
glutil::uniform_int(4, 0); // The textured batch uses GL_TEXTURE0
for (auto iter = m_batches.begin(); iter != m_batches.end(); ++iter)
{
iter->render();
}
}
}
}
}