Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
93d9766a
Commit
93d9766a
authored
Mar 22, 2018
by
schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only create the FBO once, or recreate if the size has changed
parent
77c3438b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
widgets/glWidget/QtBaseViewer.cc
widgets/glWidget/QtBaseViewer.cc
+21
-6
widgets/glWidget/QtBaseViewer.hh
widgets/glWidget/QtBaseViewer.hh
+1
-0
No files found.
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
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