Commit 76c00799 authored by Tim Übelhör's avatar Tim Übelhör

tested and fixed rasterizer

parent 3a092919
......@@ -2,6 +2,7 @@
#include <scigl_render/gl_context.hpp>
#include <scigl_render/render/depth_simulator.hpp>
#include <scigl_render/render/offscreen_render.hpp>
#include <scigl_render/render/rasterizer.hpp>
#include <scigl_render/render/texture_fullscreen_render.hpp>
#include <memory>
#include <vector>
......@@ -56,8 +57,8 @@ private:
TextureFullscreenRender texture_render;
// buffer for reading from the offscreen render
std::vector<unsigned char> image_buffer;
// renders the 3D scene
Shader scene_shader;
// display different views
Rasterizer rasterizer;
/*!
Display the data from the framebuffer
......
......@@ -22,7 +22,10 @@ DepthOffscreenRender::DepthOffscreenRender(
gl_context->get_height(),
tex_internal_format),
image_buffer(gl_context->get_width() * gl_context->get_height() *
pixel_size)
pixel_size),
rasterizer(gl_context->get_width() / 2,
gl_context->get_height() / 2,
2, 2)
{
check_gl_error("example render created");
}
......@@ -34,12 +37,21 @@ void DepthOffscreenRender::next_frame(
{
using namespace std::placeholders;
check_gl_error("next frame begin");
// render to fbo
// clear all the space
offscreen_render.clear_fbo();
offscreen_render.activate_fbo();
check_gl_error("activated fbo");
depth_simulator->render_pose(model_pose.to_quaternion_pose(),
camera_pose.to_quaternion_pose());
// render 4 poses via rasterization
for (int i = 0; i < 4; i++)
{
auto m_pose = model_pose;
m_pose.orientation.x += i * M_PI_2;
rasterizer.activate_view(i);
depth_simulator->render_pose(m_pose.to_quaternion_pose(),
camera_pose.to_quaternion_pose());
}
// back to default
rasterizer.activate_all();
offscreen_render.deactivate_fbo();
// read asynchronously using the pbos
offscreen_render.start_read(texture_format, texture_type);
......
......@@ -11,7 +11,7 @@ Rasterizer::Rasterizer(size_t width, size_t height, size_t views_per_row,
{
// create the offscreen render object
texture_width = width * views_per_row;
texture_height = width * views_per_column;
texture_height = height * views_per_column;
}
void Rasterizer::activate_view(size_t row, size_t column)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment