Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
452a6475
Commit
452a6475
authored
Apr 16, 2015
by
Christian Schulte zu Berge
Browse files
Adjusted campvis-test to Qt5 framework.
refs #249
parent
5b20d90c
Changes
9
Hide whitespace changes
Inline
Side-by-side
application/campvisapplication.cpp
View file @
452a6475
...
...
@@ -185,16 +185,7 @@ namespace campvis {
for
(
auto
it
=
_workflows
.
begin
();
it
!=
_workflows
.
end
();
++
it
)
(
*
it
)
->
deinit
();
// Stop the OpenGLJobProcessor and pass Qt thread affinity back to this thread.
QThread
*
mainThread
=
QThread
::
currentThread
();
GLJobProc
.
stop
([
&
]
()
{
this
->
_localContext
->
context
()
->
moveToThread
(
mainThread
);
});
{
// Deinit everything OpenGL related using the local context.
cgt
::
GLContextScopedLock
lock
(
_localContext
);
GLJobProc
.
enqueueJobBlocking
([
&
]()
{
delete
_errorTexture
;
// Deinit pipeline and painter first
...
...
@@ -203,7 +194,9 @@ namespace campvis {
}
_mainWindow
->
deinit
();
}
});
delete
_mainWindow
;
// now delete everything in the right order:
for
(
auto
it
=
_pipelines
.
begin
();
it
!=
_pipelines
.
end
();
++
it
)
{
...
...
application/gui/datacontainerfileloaderwidget.cpp
View file @
452a6475
...
...
@@ -45,6 +45,9 @@ namespace campvis {
}
DataContainerFileLoaderWidget
::~
DataContainerFileLoaderWidget
()
{
delete
_imgReader
;
_imgReader
=
nullptr
;
if
(
_dataContainer
!=
0
)
{
_dataContainer
->
s_dataAdded
.
disconnect
(
this
);
}
...
...
@@ -97,14 +100,6 @@ namespace campvis {
return
false
;
}
void
DataContainerFileLoaderWidget
::
init
()
{
}
void
DataContainerFileLoaderWidget
::
deinit
()
{
delete
_imgReader
;
_imgReader
=
nullptr
;
}
void
DataContainerFileLoaderWidget
::
onBtnCancelClicked
()
{
delete
_imgReader
;
_imgReader
=
nullptr
;
...
...
application/gui/datacontainerfileloaderwidget.h
View file @
452a6475
...
...
@@ -66,18 +66,7 @@ namespace campvis {
* \return QSize(300, 350)
*/
QSize
sizeHint
()
const
;
/**
* Initializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
virtual
void
init
();
/**
* Deinitializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
void
deinit
();
private
slots
:
/**
...
...
application/gui/datacontainerinspectorcanvas.cpp
View file @
452a6475
...
...
@@ -107,7 +107,6 @@ namespace campvis {
}
DataContainerInspectorCanvas
::~
DataContainerInspectorCanvas
()
{
deinit
();
}
void
DataContainerInspectorCanvas
::
init
()
{
...
...
@@ -253,7 +252,7 @@ namespace campvis {
void
DataContainerInspectorCanvas
::
invalidate
()
{
// only if inited
if
(
_quad
!=
0
&&
_paintShader
!=
0
)
{
if
(
_quad
!=
0
&&
_paintShader
!=
0
&&
this
->
isVisible
()
)
{
this
->
makeCurrent
();
paint
();
this
->
swap
();
...
...
application/gui/datacontainerinspectorwidget.cpp
View file @
452a6475
...
...
@@ -89,10 +89,6 @@ namespace campvis {
}
DataContainerInspectorWidget
::~
DataContainerInspectorWidget
()
{
if
(
_dataContainer
!=
0
)
{
_dataContainer
->
s_dataAdded
.
disconnect
(
this
);
}
delete
_pcWidget
;
_pcWidget
=
nullptr
;
}
...
...
@@ -390,18 +386,12 @@ namespace campvis {
}
void
DataContainerInspectorWidget
::
deinit
()
{
_
pcWidget
->
updatePropCollection
(
0
,
0
);
_
canvas
->
deinit
(
);
if
(
_dataContainer
!=
0
)
{
_dataContainer
->
s_dataAdded
.
disconnect
(
this
);
}
_dataContainer
=
0
;
_dctWidget
->
update
(
0
);
if
(
_propEditorWid
!=
nullptr
)
_propEditorWid
->
deinit
();
_inited
=
false
;
}
...
...
@@ -527,8 +517,8 @@ namespace campvis {
void
DataContainerInspectorWidget
::
onBtnLoadFileClicked
()
{
// delete previous PropertyEditor, then create a new one
// the final one will be deleted with deinit()
if
(
nullptr
!=
_propEditorWid
)
_propEditorWid
->
deinit
()
;
if
(
nullptr
!=
_propEditorWid
)
delete
_propEditorWid
;
_propEditorWid
=
new
DataContainerFileLoaderWidget
(
this
,
nullptr
);
_propEditorWid
->
setVisible
(
true
);
...
...
core/init.cpp
View file @
452a6475
...
...
@@ -76,12 +76,17 @@ namespace campvis {
}
void
deinit
()
{
{
// Deinit everything OpenGL related using the background context.
cgt
::
GLContextScopedLock
lock
(
GLJobProc
.
getContext
());
QuadRenderer
::
deinit
();
}
// Stop the OpenGLJobProcessor and pass Qt thread affinity back to this thread.
cgt
::
GLCanvas
*
backgroundContext
=
GLJobProc
.
getContext
();
void
*
mainThread
=
backgroundContext
->
getCurrentThreadPointer
();
GLJobProc
.
stop
([
&
]()
{
backgroundContext
->
moveThreadAffinity
(
mainThread
);
});
// now cleanly acquire this context again
backgroundContext
->
acquireAsCurrentContext
();
QuadRenderer
::
deinit
();
cgt
::
deinitGL
();
cgt
::
deinit
();
...
...
ext/cgt/init.cpp
View file @
452a6475
...
...
@@ -112,22 +112,15 @@ void initGL(GLCanvas* backgroundGlContext, InitFeature::Features featureset) {
}
void
deinitGL
()
{
GLCanvas
*
backgroundGlContext
=
GLJobProc
.
getContext
();
{
// Deinit everything OpenGL related using the local context.
GLContextScopedLock
lock
(
backgroundGlContext
);
if
(
GpuCapabilities
::
isInited
())
GpuCapabilities
::
deinit
();
if
(
GpuCapabilities
::
isInited
())
GpuCapabilities
::
deinit
();
#ifdef _MSC_VER
if
(
GpuCapabilitiesWindows
::
isInited
())
GpuCapabilitiesWindows
::
deinit
();
if
(
GpuCapabilitiesWindows
::
isInited
())
GpuCapabilitiesWindows
::
deinit
();
#endif
if
(
ShaderManager
::
isInited
())
ShaderManager
::
deinit
();
}
if
(
ShaderManager
::
isInited
())
ShaderManager
::
deinit
();
GLJobProc
.
stop
();
OpenGLJobProcessor
::
deinit
();
GlContextManager
::
deinit
();
}
...
...
test/main.cpp
View file @
452a6475
...
...
@@ -31,6 +31,7 @@
#include
"gtest/gtest.h"
#include
<stdio.h>
#include
<QApplication>
#include
<QThread>
#include
"sigslot/sigslot.h"
...
...
@@ -52,7 +53,6 @@ bool _initialized;
cgt
::
GLCanvas
*
_localContext
=
nullptr
;
static
const
std
::
string
loggerCat_
;
void
init
()
{
std
::
vector
<
std
::
string
>
searchPaths
;
#ifdef CAMPVIS_SOURCE_DIR
...
...
@@ -64,8 +64,7 @@ void init() {
_localContext
=
new
cgt
::
QtThreadedCanvas
(
""
,
cgt
::
ivec2
(
16
,
16
));
cgt
::
GlContextManager
::
getRef
().
registerContextAndInitGlew
(
_localContext
,
"Local Context"
);
GLCtxtMgr
.
releaseContext
(
_localContext
,
false
);
_initialized
=
true
;
}
...
...
@@ -78,29 +77,25 @@ void deinit() {
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"Running main() from main.cpp
\n
"
);
app
=
new
QApplication
(
argc
,
argv
);
// Make Xlib and GLX thread safe under X11
QCoreApplication
::
setAttribute
(
Qt
::
AA_X11InitThreads
);
app
=
new
QApplication
(
argc
,
argv
);
QApplication
::
setAttribute
(
Qt
::
AA_X11InitThreads
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
init
();
int
ret
;
std
::
thread
testThread
([
&
]
()
{
{
cgt
::
GLContextScopedLock
lock
(
_localContext
);
ret
=
RUN_ALL_TESTS
();
}
deinit
();
app
->
exit
();
});
app
->
exec
();
testThread
.
join
();
delete
app
;
init
();
{
cgt
::
GLContextScopedLock
lock
(
_localContext
);
ret
=
RUN_ALL_TESTS
();
}
deinit
();
app
->
quit
();
delete
app
;
printf
(
"main() returned with %d
\n
"
,
ret
);
return
ret
;
return
0
;
}
test/modules/pipelineresultimagetest.cpp
View file @
452a6475
...
...
@@ -84,6 +84,7 @@ protected:
void
init
()
{
// create pipeline
_pipeline
=
PipelineFactory
::
getRef
().
createPipeline
(
_pipelineName
,
_dataContainer
);
ASSERT_TRUE
(
_pipeline
!=
nullptr
);
if
(
_pipeline
!=
nullptr
)
{
// setup pipeline
...
...
@@ -172,14 +173,17 @@ TEST_F(PipelineWriteResultImageTest, VectorFieldDemo) {
_pipelineName
=
"VectorFieldDemo"
;
_fileName
=
_basePath
+
"vectorfielddemo.png"
;
init
();
execute
();
if
(
!
_pipeline
)
return
;
execute
();
AbstractProperty
*
p
=
_pipeline
->
getProperty
(
"SliceNuber"
);
if
(
IntProperty
*
tester
=
dynamic_cast
<
IntProperty
*>
(
p
))
{
tester
->
setValue
(
64
);
tester
->
setValue
(
64
);
}
execute
();
EXPECT_TRUE
(
_wroteFile
);
}
...
...
@@ -187,8 +191,11 @@ TEST_F(PipelineWriteResultImageTest, DVRVis) {
_pipelineName
=
"DVRVis"
;
_fileName
=
_basePath
+
"dvrvis.png"
;
init
();
execute
();
if
(
!
_pipeline
)
return
;
execute
();
auto
properties
=
_pipeline
->
getProcessors
();
for
(
auto
it
=
properties
.
begin
();
it
!=
properties
.
end
();
++
it
)
{
if
(
TrackballCameraProvider
*
tcp
=
dynamic_cast
<
TrackballCameraProvider
*>
(
*
it
))
{
...
...
@@ -206,8 +213,11 @@ TEST_F(PipelineWriteResultImageTest, TensorDemo) {
_pipelineName
=
"TensorDemo"
;
_fileName
=
_basePath
+
"tensordemo.png"
;
init
();
execute
();
if
(
!
_pipeline
)
return
;
execute
();
AbstractProperty
*
p
=
_pipeline
->
getProperty
(
"SliceNuber"
);
if
(
IntProperty
*
tester
=
dynamic_cast
<
IntProperty
*>
(
p
))
{
tester
->
setValue
(
6
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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