Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
9670d2b0
Commit
9670d2b0
authored
Apr 23, 2014
by
Hossain Mahmud
Committed by
Christian Schulte zu Berge
Apr 23, 2014
Browse files
shadder location fixed
parent
f8433075
Changes
4
Show whitespace changes
Inline
Side-by-side
core/tools/glreduction.cpp
View file @
9670d2b0
...
...
@@ -43,24 +43,17 @@ namespace campvis {
const
std
::
string
GlReduction
::
loggerCat_
=
"CAMPVis.modules.registration.GlReduction"
;
GlReduction
::
GlReduction
(
ReductionOperator
reductionOperator
,
bool
isForTesting
)
GlReduction
::
GlReduction
(
ReductionOperator
reductionOperator
)
:
_reductionOperator
(
reductionOperator
)
,
_shader1d
(
0
)
,
_shader2d
(
0
)
,
_shader3d
(
0
)
,
_fbo
(
0
)
{
//TODO: discuss details, and generalize this
if
(
!
isForTesting
)
{
_shader1d
=
ShdrMgr
.
load
(
"core/glsl/passthrough.vert"
,
"core/glsl/tools/glreduction.frag"
,
generateGlslHeader
(
_reductionOperator
)
+
"#define REDUCTION_1D
\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
)
{
LERROR
(
"Could not load Shader for OpenGL reduction. Reduction will not work!"
);
return
;
...
...
core/tools/glreduction.h
View file @
9670d2b0
...
...
@@ -63,7 +63,7 @@ namespace campvis {
* Constructor
* \param reductionOperator Operation to be performed by reduction
*/
GlReduction
(
ReductionOperator
reductionOperator
,
bool
isForTesting
=
false
);
GlReduction
(
ReductionOperator
reductionOperator
);
/**
* Destructor
...
...
test/core/tools/glreductiontest.cpp
View file @
9670d2b0
...
...
@@ -61,9 +61,7 @@ protected:
}
~
GlReductionTest
()
{
//delete localRep;
delete
imgData
;
//delete rawData;
delete
glReduction
;
}
...
...
@@ -110,7 +108,7 @@ TEST_F(GlReductionTest, localRepCreationTest) {
* Tests for ReducationOperator::MIN.
*/
TEST_F
(
GlReductionTest
,
minTest
)
{
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MIN
,
true
);
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MIN
);
std
::
vector
<
float
>
reduced
=
glReduction
->
reduce
(
imgData
);
ASSERT_NEAR
(
0
,
reduced
[
0
],
0.0001
);
...
...
@@ -121,7 +119,7 @@ TEST_F(GlReductionTest, minTest) {
* Tests for ReducationOperator::MAX.
*/
TEST_F
(
GlReductionTest
,
maxTest
)
{
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MAX
,
true
);
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MAX
);
std
::
vector
<
float
>
reduced
=
glReduction
->
reduce
(
imgData
);
ASSERT_NEAR
(
1
,
reduced
[
0
],
0.0001
);
...
...
@@ -132,7 +130,7 @@ TEST_F(GlReductionTest, maxTest) {
* Tests for ReducationOperator::PLUS.
*/
TEST_F
(
GlReductionTest
,
sumTest
)
{
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
PLUS
,
true
);
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
PLUS
);
std
::
vector
<
float
>
reduced
=
glReduction
->
reduce
(
imgData
);
ASSERT_NEAR
(
1
,
reduced
[
0
],
0.0001
);
...
...
@@ -143,7 +141,7 @@ TEST_F(GlReductionTest, sumTest) {
* Tests for ReducationOperator::MULTIPLICATION.
*/
TEST_F
(
GlReductionTest
,
multTest
)
{
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MULTIPLICATION
,
true
);
glReduction
=
new
GlReduction
(
GlReduction
::
ReductionOperator
::
MULTIPLICATION
);
std
::
vector
<
float
>
reduced
=
glReduction
->
reduce
(
imgData
);
ASSERT_NEAR
(
0
,
reduced
[
0
],
0.0001
);
...
...
test/main.cpp
View file @
9670d2b0
...
...
@@ -89,6 +89,14 @@ void 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
LINFO
(
"Using Graphics Hardware "
<<
GpuCaps
.
getVendorAsString
()
<<
" "
<<
GpuCaps
.
getGlRendererString
()
<<
" on "
<<
GpuCaps
.
getOSVersionString
());
LINFO
(
"Supported OpenGL "
<<
GpuCaps
.
getGlVersion
()
<<
", GLSL "
<<
GpuCaps
.
getShaderVersion
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment