Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
93d9766a
Commit
93d9766a
authored
Mar 22, 2018
by
schultz
Browse files
only create the FBO once, or recreate if the size has changed
parent
77c3438b
Changes
2
Hide whitespace changes
Inline
Side-by-side
widgets/glWidget/QtBaseViewer.cc
View file @
93d9766a
...
...
@@ -138,6 +138,7 @@ glViewer::glViewer( QGraphicsScene* _scene,
glDebugLogger_
(
0
),
#endif
pickCache_
(
0
),
mouseCache_
(
0
),
updatePickCache_
(
true
),
pickCacheSupported_
(
true
),
constrainedRotationAxis_
(
std
::
numeric_limits
<
double
>::
quiet_NaN
(),
0
,
0
),
...
...
@@ -217,6 +218,8 @@ glViewer::~glViewer()
delete
glstate_
;
deleteGLDebugLogger
();
if
(
mouseCache_
!=
nullptr
)
deleteQFBO
(
mouseCache_
);
}
...
...
@@ -1571,10 +1574,24 @@ void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
emit
signalMakeActive
();
const
GLuint
prevFBO
=
ACG
::
GLState
::
getFramebufferDraw
();
QFramebufferObject
*
nonMultisampledFBO
;
GLuint
fboHandle
;
int
samples
=
0
;
createQFBO
(
nonMultisampledFBO
,
&
fboHandle
,
glWidth
(),
glHeight
(),
&
samples
);
static
unsigned
int
creationHeight
=
0
;
static
unsigned
int
creationWidth
=
0
;
static
GLuint
fboHandle
;
//recreate FBO if gl area was resized
if
(
mouseCache_
!=
nullptr
&&
(
glWidth
()
!=
creationWidth
||
glHeight
()
!=
creationHeight
))
{
deleteQFBO
(
mouseCache_
);
mouseCache_
=
nullptr
;
}
if
(
mouseCache_
==
nullptr
)
{
int
samples
=
0
;
creationHeight
=
glHeight
();
creationWidth
=
glWidth
();
createQFBO
(
mouseCache_
,
&
fboHandle
,
creationWidth
,
creationHeight
,
&
samples
);
}
ACG
::
GLState
::
bindFramebuffer
(
GL_FRAMEBUFFER_EXT
,
fboHandle
);
glScene_
->
update
();
...
...
@@ -1617,8 +1634,6 @@ void glViewer::mousePressEvent(QGraphicsSceneMouseEvent* _e)
}
//restore old FBO
ACG
::
GLState
::
bindFramebuffer
(
GL_FRAMEBUFFER_EXT
,
prevFBO
);
//cleanup
deleteQFBO
(
nonMultisampledFBO
);
}
...
...
widgets/glWidget/QtBaseViewer.hh
View file @
93d9766a
...
...
@@ -889,6 +889,7 @@ private:
/// Framebuffer object that holds the pick cache
QFramebufferObject
*
pickCache_
;
QFramebufferObject
*
mouseCache_
;
/// Should the pick cache be updated
bool
updatePickCache_
;
...
...
Write
Preview
Supports
Markdown
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