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
O
OpenFlipper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
6eef6823
Commit
6eef6823
authored
May 08, 2020
by
Jan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some sprintf warnings
parent
245e85a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
19 deletions
+15
-19
libs_required/ACG/GL/FilterKernels.cc
libs_required/ACG/GL/FilterKernels.cc
+7
-10
libs_required/ACG/GL/FilterKernels.hh
libs_required/ACG/GL/FilterKernels.hh
+1
-2
libs_required/ACG/GL/ShaderGenerator.cc
libs_required/ACG/GL/ShaderGenerator.cc
+7
-7
No files found.
libs_required/ACG/GL/FilterKernels.cc
View file @
6eef6823
...
...
@@ -238,8 +238,7 @@ void GaussianBlurFilter::updateKernel()
for
(
int
i
=
0
;
i
<
samples_
;
++
i
)
weights_
[
i
]
/=
weightSum
;
QString
blurSamplesMacro
;
blurSamplesMacro
.
sprintf
(
"#define BLUR_SAMPLES %i"
,
samples_
);
QString
blurSamplesMacro
=
QString
(
"#define BLUR_SAMPLES %1"
).
arg
(
samples_
);
macros_
.
clear
();
macros_
.
push_back
(
blurSamplesMacro
);
}
...
...
@@ -345,8 +344,7 @@ void BilateralBlurFilter::updateKernel()
macros_
.
clear
();
QString
radiusMacro
;
radiusMacro
.
sprintf
(
"#define BLUR_SAMPLES %i"
,
samples_
);
QString
radiusMacro
=
QString
(
"#define BLUR_SAMPLES %1"
).
arg
(
samples_
);
int
numChannels
=
GLFormatInfo
(
internalFormat
()).
channelCount
();
numChannels
=
std
::
max
(
std
::
min
(
numChannels
,
4
),
1
);
...
...
@@ -359,8 +357,8 @@ void BilateralBlurFilter::updateKernel()
"BLUR_RGBA"
};
QString
channelMacro
;
channelMacro
.
sprintf
(
"#define BLUR_CHANNELS %s"
,
blurChannels
[
numChannels
-
1
]);
// %1 printed as %s
QString
channelMacro
=
QString
(
"#define BLUR_CHANNELS %1"
).
arg
(
blurChannels
[
numChannels
-
1
]);
macros_
.
push_back
(
radiusMacro
);
macros_
.
push_back
(
channelMacro
);
...
...
@@ -449,8 +447,8 @@ void RadialBlurFilter::setKernel( int _numSamples )
samples_
=
_numSamples
;
macros_
.
clear
();
QString
sampleMacro
;
sampleMacro
.
sprintf
(
"#define BLUR_SAMPLES %i"
,
_numSamples
);
QString
sampleMacro
=
QString
(
"#define BLUR_SAMPLES %1"
).
arg
(
_numSamples
);
macros_
.
push_back
(
sampleMacro
);
}
...
...
@@ -633,8 +631,7 @@ PoissonBlurFilter::PoissonBlurFilter(float _radius, float _sampleDistance, int _
samplesScaled_
=
samples_
;
QString
samplesMacro
;
samplesMacro
.
sprintf
(
"#define BLUR_SAMPLES %i"
,
numSamples
);
QString
samplesMacro
=
QString
(
"#define BLUR_SAMPLES %1"
).
arg
(
numSamples
);
macros_
.
push_back
(
samplesMacro
);
}
...
...
libs_required/ACG/GL/FilterKernels.hh
View file @
6eef6823
...
...
@@ -207,8 +207,7 @@ protected:
private:
int
radius_
,
samples_
;
int
radius_
,
samples_
;
/// blur std
float
sigma_
;
...
...
libs_required/ACG/GL/ShaderGenerator.cc
View file @
6eef6823
...
...
@@ -220,7 +220,7 @@ void ShaderGenerator::initVertexShaderIO(const ShaderGenDesc* _desc, const Defau
QString
texcoordType
;
if
(
texdim
>
1
)
texcoordType
.
sprintf
(
"vec%i"
,
texdim
);
texcoordType
=
QString
(
"vec%1"
).
arg
(
texdim
);
else
texcoordType
=
"float"
;
...
...
@@ -402,12 +402,14 @@ void ShaderGenerator::initDefaultUniforms()
}
#define ADDLIGHT(x)
(sz.sprintf(x"_%d", lightIndex_), addUniform(sz)
)
#define ADDLIGHT(x)
addUniform( QString( QString(x) + "_%1").arg(lightIndex_)
)
void
ShaderGenerator
::
addLight
(
int
lightIndex_
,
ShaderGenLightType
_light
)
{
QString
sz
;
QTextStream
stream
(
&
sz
);
ADDLIGHT
(
"vec3 g_cLightDiffuse"
);
ADDLIGHT
(
"vec3 g_cLightAmbient"
);
ADDLIGHT
(
"vec3 g_cLightSpecular"
);
...
...
@@ -553,8 +555,7 @@ void ShaderGenerator::addIOToCode(const QStringList& _cmds)
void
ShaderGenerator
::
buildShaderCode
(
QStringList
*
_pMainCode
,
const
QStringList
&
_defaultLightingFunctions
)
{
QString
glslversion
;
glslversion
.
sprintf
(
"#version %d"
,
version_
);
QString
glslversion
=
QString
(
"#version %1"
).
arg
(
version_
);
code_
.
push_back
(
glslversion
);
...
...
@@ -1053,8 +1054,7 @@ void ShaderProgGenerator::initGenDefines(ShaderGenerator* _gen)
_gen
->
addDefine
(
"SG_POSOS 1"
);
// # lights define
QString
strNumLights
;
strNumLights
.
sprintf
(
"SG_NUM_LIGHTS %d"
,
desc_
.
numLights
);
QString
strNumLights
=
QString
(
"SG_NUM_LIGHTS %1"
).
arg
(
desc_
.
numLights
);
_gen
->
addDefine
(
strNumLights
);
// light types define
...
...
@@ -1986,7 +1986,7 @@ void ShaderProgGenerator::addTexGenCode( QStringList* _code, bool _fragmentShade
if
(
texcoordVarDim
==
1
)
texcoordVarInit
=
"float sg_vTexCoord"
;
else
texcoordVarInit
.
sprintf
(
"vec%i sg_vTexCoord"
,
texcoordVarDim
);
texcoordVarInit
=
QString
(
"vec%1 sg_vTexCoord"
).
arg
(
texcoordVarDim
);
// init with default value: input or zero
if
(
ioDesc_
.
inputTexCoord_
&&
!
generateTexCoord
)
...
...
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