Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
5f83b5b9
Commit
5f83b5b9
authored
Nov 06, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhance rendering of text by mixing front & back color
parent
8b62d1d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
include/Utils/text3d.h
include/Utils/text3d.h
+1
-0
src/Utils/text3d.cpp
src/Utils/text3d.cpp
+19
-11
No files found.
include/Utils/text3d.h
View file @
5f83b5b9
...
...
@@ -54,6 +54,7 @@ protected:
static
std
::
string
fragmentShaderText1
;
static
std
::
string
fragmentShaderText2
;
static
std
::
string
fragmentShaderText3
;
static
Strings3D
*
m_instance0
;
...
...
src/Utils/text3d.cpp
View file @
5f83b5b9
...
...
@@ -36,8 +36,10 @@ namespace Utils
std
::
string
Strings3D
::
fragmentShaderText2
=
" gl_FragColor = color*lum;
\n
"
"}"
;
" if (lum == 0.0) discard;
\n
gl_FragColor = color*lum;
\n
}"
;
std
::
string
Strings3D
::
fragmentShaderText3
=
" gl_FragColor = mix(backColor,color,lum);
\n
}"
;
Strings3D
*
Strings3D
::
m_instance0
=
NULL
;
...
...
@@ -70,22 +72,28 @@ Strings3D::Strings3D(bool withBackground, const Geom::Vec3f& bgc, bool with_plan
if
(
with_plane
)
glxvert
.
append
(
"#define WITH_PLANE 1"
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
glxfrag
.
append
(
fragmentShaderText1
);
std
::
string
background
;
if
(
!
withBackground
)
glxfrag
.
append
(
"if (lum == 0.0) discard;
\n
"
);
else
if
(
bgc
*
bgc
>
0.0
)
{
glxfrag
.
append
(
fragmentShaderText2
);
}
else
{
std
::
stringstream
ss
;
ss
<<
" if (lum==0.0) gl_FragColor=vec4("
;
ss
<<
bgc
[
0
]
<<
","
<<
bgc
[
1
]
<<
","
<<
bgc
[
2
]
<<
",color[3]);
\n
else
\n
"
;
background
.
append
(
ss
.
str
());
ss
<<
"vec4 backColor = vec4("
<<
bgc
[
0
]
<<
","
<<
bgc
[
1
]
<<
","
<<
bgc
[
2
]
<<
",color[3]);
\n
"
;
// ss << "vec4 backColor = vec4(0.2,0.1,0.4);\n";
glxfrag
.
append
(
ss
.
str
());
glxfrag
.
append
(
fragmentShaderText3
);
}
glxfrag
.
append
(
background
);
glxfrag
.
append
(
fragmentShaderText2
);
std
::
cout
<<
"===================================="
<<
std
::
endl
;
std
::
cout
<<
glxfrag
<<
std
::
endl
;
std
::
cout
<<
"===================================="
<<
std
::
endl
;
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
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