Commit 9670d2b0 authored by Hossain Mahmud's avatar Hossain Mahmud Committed by Christian Schulte zu Berge
Browse files

shadder location fixed

parent f8433075
...@@ -43,24 +43,17 @@ namespace campvis { ...@@ -43,24 +43,17 @@ namespace campvis {
const std::string GlReduction::loggerCat_ = "CAMPVis.modules.registration.GlReduction"; const std::string GlReduction::loggerCat_ = "CAMPVis.modules.registration.GlReduction";
GlReduction::GlReduction(ReductionOperator reductionOperator, bool isForTesting) GlReduction::GlReduction(ReductionOperator reductionOperator)
: _reductionOperator(reductionOperator) : _reductionOperator(reductionOperator)
, _shader1d(0) , _shader1d(0)
, _shader2d(0) , _shader2d(0)
, _shader3d(0) , _shader3d(0)
, _fbo(0) , _fbo(0)
{ {
//TODO: discuss details, and generalize this _shader1d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_1D\n");
if(!isForTesting) { _shader2d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_2D\n");
_shader1d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_1D\n"); _shader3d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_3D\n");
_shader2d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_2D\n");
_shader3d = ShdrMgr.load("core/glsl/passthrough.vert", "core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_3D\n");
}
else {
_shader1d = ShdrMgr.load("../src/core/glsl/passthrough.vert", "../src/core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_1D\n");
_shader2d = ShdrMgr.load("../src/core/glsl/passthrough.vert", "../src/core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_2D\n");
_shader3d = ShdrMgr.load("../src/core/glsl/passthrough.vert", "../src/core/glsl/tools/glreduction.frag", generateGlslHeader(_reductionOperator) + "#define REDUCTION_3D\n");
}
if (_shader1d == 0 || _shader2d == 0 || _shader3d == 0) { if (_shader1d == 0 || _shader2d == 0 || _shader3d == 0) {
LERROR("Could not load Shader for OpenGL reduction. Reduction will not work!"); LERROR("Could not load Shader for OpenGL reduction. Reduction will not work!");
return; return;
......
...@@ -63,7 +63,7 @@ namespace campvis { ...@@ -63,7 +63,7 @@ namespace campvis {
* Constructor * Constructor
* \param reductionOperator Operation to be performed by reduction * \param reductionOperator Operation to be performed by reduction
*/ */
GlReduction(ReductionOperator reductionOperator, bool isForTesting = false); GlReduction(ReductionOperator reductionOperator);
/** /**
* Destructor * Destructor
......
...@@ -61,9 +61,7 @@ protected: ...@@ -61,9 +61,7 @@ protected:
} }
~GlReductionTest() { ~GlReductionTest() {
//delete localRep;
delete imgData; delete imgData;
//delete rawData;
delete glReduction; delete glReduction;
} }
...@@ -110,7 +108,7 @@ TEST_F(GlReductionTest, localRepCreationTest) { ...@@ -110,7 +108,7 @@ TEST_F(GlReductionTest, localRepCreationTest) {
* Tests for ReducationOperator::MIN. * Tests for ReducationOperator::MIN.
*/ */
TEST_F(GlReductionTest, minTest) { TEST_F(GlReductionTest, minTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MIN, true); glReduction = new GlReduction(GlReduction::ReductionOperator::MIN);
std::vector<float> reduced = glReduction->reduce(imgData); std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(0, reduced[0], 0.0001); ASSERT_NEAR(0, reduced[0], 0.0001);
...@@ -121,7 +119,7 @@ TEST_F(GlReductionTest, minTest) { ...@@ -121,7 +119,7 @@ TEST_F(GlReductionTest, minTest) {
* Tests for ReducationOperator::MAX. * Tests for ReducationOperator::MAX.
*/ */
TEST_F(GlReductionTest, maxTest) { TEST_F(GlReductionTest, maxTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MAX, true); glReduction = new GlReduction(GlReduction::ReductionOperator::MAX);
std::vector<float> reduced = glReduction->reduce(imgData); std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(1, reduced[0], 0.0001); ASSERT_NEAR(1, reduced[0], 0.0001);
...@@ -132,7 +130,7 @@ TEST_F(GlReductionTest, maxTest) { ...@@ -132,7 +130,7 @@ TEST_F(GlReductionTest, maxTest) {
* Tests for ReducationOperator::PLUS. * Tests for ReducationOperator::PLUS.
*/ */
TEST_F(GlReductionTest, sumTest) { TEST_F(GlReductionTest, sumTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::PLUS, true); glReduction = new GlReduction(GlReduction::ReductionOperator::PLUS);
std::vector<float> reduced = glReduction->reduce(imgData); std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(1, reduced[0], 0.0001); ASSERT_NEAR(1, reduced[0], 0.0001);
...@@ -143,7 +141,7 @@ TEST_F(GlReductionTest, sumTest) { ...@@ -143,7 +141,7 @@ TEST_F(GlReductionTest, sumTest) {
* Tests for ReducationOperator::MULTIPLICATION. * Tests for ReducationOperator::MULTIPLICATION.
*/ */
TEST_F(GlReductionTest, multTest) { TEST_F(GlReductionTest, multTest) {
glReduction = new GlReduction(GlReduction::ReductionOperator::MULTIPLICATION, true); glReduction = new GlReduction(GlReduction::ReductionOperator::MULTIPLICATION);
std::vector<float> reduced = glReduction->reduce(imgData); std::vector<float> reduced = glReduction->reduce(imgData);
ASSERT_NEAR(0, reduced[0], 0.0001); ASSERT_NEAR(0, reduced[0], 0.0001);
......
...@@ -89,6 +89,14 @@ void init() { ...@@ -89,6 +89,14 @@ void init() {
campvis::QuadRenderer::init(); campvis::QuadRenderer::init();
#ifdef CAMPVIS_SOURCE_DIR
{
std::string sourcePath = CAMPVIS_SOURCE_DIR;
ShdrMgr.addPath(sourcePath);
ShdrMgr.addPath(sourcePath + "/core/glsl");
}
#endif
// ensure matching OpenGL specs // ensure matching OpenGL specs
LINFO("Using Graphics Hardware " << GpuCaps.getVendorAsString() << " " << GpuCaps.getGlRendererString() << " on " << GpuCaps.getOSVersionString()); LINFO("Using Graphics Hardware " << GpuCaps.getVendorAsString() << " " << GpuCaps.getGlRendererString() << " on " << GpuCaps.getOSVersionString());
LINFO("Supported OpenGL " << GpuCaps.getGlVersion() << ", GLSL " << GpuCaps.getShaderVersion()); LINFO("Supported OpenGL " << GpuCaps.getGlVersion() << ", GLSL " << GpuCaps.getShaderVersion());
......
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