Skip to content
GitLab
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
cc3912fb
Commit
cc3912fb
authored
Sep 06, 2017
by
Martin Schultz
Browse files
adopted baseViewer from QOpenGL branch
parent
aa28fa5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
widgets/glWidget/QtBaseViewer.cc
View file @
cc3912fb
...
...
@@ -156,7 +156,8 @@ glViewer::glViewer( QGraphicsScene* _scene,
createWidgets
();
// bind GL context to GL state class
glstate_
=
new
ACG
::
GLState
();
glstate_
=
new
ACG
::
GLState
(
true
,
_glWidget
->
format
().
profile
()
==
OFGLFormat
::
CompatibilityProfile
);
properties_
.
setglState
(
glstate_
);
// state
...
...
@@ -501,10 +502,12 @@ void glViewer::lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const A
void
glViewer
::
normalsMode
(
NormalsMode
_mode
)
{
makeCurrent
();
switch
(
normalsMode_
=
_mode
)
if
(
glstate_
->
compatibilityProfile
())
{
makeCurrent
();
switch
(
normalsMode_
=
_mode
)
{
case
DONT_TOUCH_NORMALS
:
ACG
::
GLState
::
disable
(
GL_NORMALIZE
);
break
;
...
...
@@ -512,9 +515,10 @@ void glViewer::normalsMode(NormalsMode _mode)
case
NORMALIZE_NORMALS
:
ACG
::
GLState
::
enable
(
GL_NORMALIZE
);
break
;
}
}
updateGL
();
updateGL
();
}
}
...
...
@@ -674,7 +678,10 @@ void glViewer::drawScene(double _aspect)
ACG
::
IRenderer
*
shaderRenderPlugin
=
dynamic_cast
<
ACG
::
IRenderer
*>
(
renderPlugin
);
if
(
shaderRenderPlugin
)
{
shaderRenderPlugin
->
setViewerID
(
properties_
.
viewerId
()
);
shaderRenderPlugin
->
setCoreProfileMode
(
OpenFlipper
::
Options
::
coreProfile
()
);
}
if
(
stereoOpenGL
||
stereoAnaglyph
)
{
// save current fbo
...
...
@@ -821,7 +828,10 @@ void glViewer::drawScene_mono()
ACG
::
GLState
::
enable
(
GL_BLEND
);
ACG
::
GLState
::
disable
(
GL_DEPTH_TEST
);
ACG
::
GLState
::
disable
(
GL_LIGHTING
);
if
(
glstate_
->
compatibilityProfile
())
ACG
::
GLState
::
disable
(
GL_LIGHTING
);
ACG
::
GLState
::
disable
(
GL_DITHER
);
int
vp_l
,
vp_b
,
vp_w
,
vp_h
;
...
...
@@ -991,9 +1001,14 @@ void glViewer::initializeGL()
// OpenGL state
ACG
::
GLState
::
enable
(
GL_DEPTH_TEST
);
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
if
(
glstate_
->
compatibilityProfile
())
{
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
ACG
::
GLState
::
shadeModel
(
GL_FLAT
);
}
ACG
::
GLState
::
disable
(
GL_DITHER
);
ACG
::
GLState
::
shadeModel
(
GL_FLAT
);
projectionMode
(
projectionMode_
);
...
...
@@ -1049,27 +1064,35 @@ void glViewer::paintGL(double _aspect)
{
properties_
.
lockUpdate
();
glPushAttrib
(
GL_ALL_ATTRIB_BITS
);
ACG
::
GLState
::
enable
(
GL_DEPTH_TEST
);
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
ACG
::
GLState
::
disable
(
GL_DITHER
);
ACG
::
GLState
::
shadeModel
(
GL_FLAT
);
glMatrixMode
(
GL_PROJECTION
);
glPushMatrix
();
if
(
glstate_
->
compatibilityProfile
())
{
glPushAttrib
(
GL_ALL_ATTRIB_BITS
);
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
glMatrixMode
(
GL_PROJECTION
);
glPushMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
normalsMode
(
normalsMode_
);
normalsMode
(
normalsMode_
);
ACG
::
GLState
::
shadeModel
(
GL_FLAT
);
}
ACG
::
GLState
::
disable
(
GL_DITHER
);
applyProperties
();
glstate_
->
setState
();
glColor4f
(
1.0
,
0.0
,
0.0
,
1.0
);
if
(
glstate_
->
compatibilityProfile
())
glColor4f
(
1.0
,
0.0
,
0.0
,
1.0
);
glstate_
->
clearBuffers
();
...
...
@@ -1078,12 +1101,15 @@ void glViewer::paintGL(double _aspect)
// draw scene
drawScene
(
_aspect
);
glPopMatrix
();
if
(
glstate_
->
compatibilityProfile
())
{
glPopMatrix
();
glMatrixMode
(
GL_PROJECTION
);
glPopMatrix
();
glMatrixMode
(
GL_PROJECTION
);
glPopMatrix
();
glPopAttrib
();
glPopAttrib
();
}
}
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
0
);
...
...
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