Commit 6eef6823 authored by Jan's avatar Jan

Fixed some sprintf warnings

parent 245e85a1
......@@ -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);
}
......
......@@ -207,8 +207,7 @@ protected:
private:
int radius_,
samples_;
int radius_, samples_;
/// blur std
float sigma_;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment