MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / SumReduce

Method SumReduce

simulation/src/sum_reduce.cpp:5–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace pcl::simulation;
4
5pcl::simulation::SumReduce::SumReduce(int width, int height, int levels)
6: levels_(levels), width_(width), height_(height), sum_program_(new gllib::Program())
7{
8 std::cout << "SumReduce: levels: " << levels_ << std::endl;
9
10 // TODO: to remove file dependency include the shader source in the binary
11 if (!sum_program_->addShaderFile("sum_score.vert", gllib::VERTEX)) {
12 std::cout << "Failed loading vertex shader" << std::endl;
13 exit(-1);
14 }
15
16 // TODO: to remove file dependency include the shader source in the binary
17 if (!sum_program_->addShaderFile("sum_score.frag", gllib::FRAGMENT)) {
18 std::cout << "Failed loading fragment shader" << std::endl;
19 exit(-1);
20 }
21
22 sum_program_->link();
23
24 // Setup the framebuffer object for rendering
25 glGenFramebuffers(1, &fbo_);
26 arrays_ = new GLuint[levels_];
27
28 glGenTextures(levels_, arrays_);
29
30 int level_width = width_;
31 int level_height = height_;
32
33 for (int i = 0; i < levels_; ++i) {
34 level_width /= 2;
35 level_height /= 2;
36
37 glBindTexture(GL_TEXTURE_2D, arrays_[i]);
38 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
39 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
40 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
41 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
42 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
43 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
44 glTexImage2D(GL_TEXTURE_2D,
45 0,
46 GL_R32F,
47 level_width,
48 level_height,
49 0,
50 GL_RED,
51 GL_FLOAT,
52 nullptr);
53 glBindTexture(GL_TEXTURE_2D, 0);
54 }
55}
56
57pcl::simulation::SumReduce::~SumReduce()
58{

Callers

nothing calls this directly

Calls 2

addShaderFileMethod · 0.80
linkMethod · 0.80

Tested by

no test coverage detected