Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
af94ecd5
Commit
af94ecd5
authored
Jan 20, 2017
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change background when the light is on
parent
9808cd03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
QtMeshViewer/Header/OglViewerWidget.h
QtMeshViewer/Header/OglViewerWidget.h
+2
-0
QtMeshViewer/Source/MainWindow.cpp
QtMeshViewer/Source/MainWindow.cpp
+1
-0
QtMeshViewer/Source/OglViewerWidget.cpp
QtMeshViewer/Source/OglViewerWidget.cpp
+9
-3
No files found.
QtMeshViewer/Header/OglViewerWidget.h
View file @
af94ecd5
...
...
@@ -44,6 +44,8 @@ private:
float
ambientCoefficient
=
0.005
f
;
}
m_light
;
QVector4D
m_backgroundColor
=
{
0.5
f
,
0.8
f
,
1.0
f
,
1.0
f
};
QOpenGLShaderProgram
m_program
;
GeometryEngine
*
m_dataEngine
;
...
...
QtMeshViewer/Source/MainWindow.cpp
View file @
af94ecd5
...
...
@@ -188,6 +188,7 @@ void MainWindow::setFileInfo(QString name, QVector<Material>* materials, int ver
int
count
(
0
);
//TODO: mark not opened textures
//TODO: add more information
for
(
auto
&
it
:
*
materials
)
{
m_fileInfo
+=
"Material "
;
...
...
QtMeshViewer/Source/OglViewerWidget.cpp
View file @
af94ecd5
...
...
@@ -184,7 +184,7 @@ void OglViewerWidget::initializeGL()
{
initializeOpenGLFunctions
();
glClearColor
(
0.5000
f
,
0.8000
f
,
1.0000
f
,
0.0000
f
);
//
glClearColor(0.5000f, 0.8000f, 1.0000f, 0.0000f);
initShaders
();
...
...
@@ -222,6 +222,12 @@ void OglViewerWidget::paintGL()
// Clear color and depth buffer
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
if
(
m_backgroundColor
[
3
]
==
1.0
)
{
glClearColor
(
m_backgroundColor
[
0
],
m_backgroundColor
[
1
],
m_backgroundColor
[
2
],
0.0000
f
);
m_backgroundColor
[
3
]
=
0.0
;
}
// Calculate model view transformation
QMatrix4x4
view
;
view
.
translate
(
m_translation
);
...
...
@@ -330,13 +336,13 @@ void OglViewerWidget::toggleLight()
if
(
m_lightOn
)
{
glClearColor
(
m_light
.
intensities
.
x
()
/
100
,
m_light
.
intensities
.
y
()
/
100
,
m_light
.
intensities
.
z
()
/
100
,
0.0000
f
)
;
m_backgroundColor
=
{
m_light
.
intensities
.
x
()
/
100
,
m_light
.
intensities
.
y
()
/
100
,
m_light
.
intensities
.
z
()
/
100
,
1.0
}
;
updateLightPosition
();
}
else
{
glClearColor
(
0.5000
f
,
0.8000
f
,
1.0000
f
,
0.0000
f
)
;
m_backgroundColor
=
{
0.5
f
,
0.8
f
,
1.0
f
,
1.0
}
;
}
update
();
...
...
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