- for( size_t i(0); result && i<textures.size(); ++i )
- {
- ResourceId textureId = textures[i].GetTextureId();
- Internal::Texture* texture = textureCache.GetTexture( textureId );
- if( texture )
- {
- result = textureCache.BindTexture( texture, textureId, GL_TEXTURE_2D, (TextureUnit)textureUnit );
-
- if( result )
- {
- GLint uniformLocation;
-
- //TODO : This is a bug, result variable is being shadowed. Fix it!
- bool result = program.GetSamplerUniformLocation( i, uniformLocation );
- if( result && Program::UNIFORM_UNKNOWN != uniformLocation )
- {
- program.SetUniform1i( uniformLocation, textureUnit );
-
- unsigned int samplerBitfield(ImageSampler::DEFAULT_BITFIELD);
- const Render::Sampler* sampler( samplers[i] );
- if( sampler )
- {
- samplerBitfield = sampler->mBitfield;
- }
-
- texture->ApplySampler( (TextureUnit)textureUnit, samplerBitfield );
-
- ++textureUnit;
- }
- }
- }
- }
-
- std::vector<Render::NewTexture*>& newTextures( mRenderDataProvider->GetNewTextures() );
- for( size_t i(0); result && i<newTextures.size(); ++i )
+ std::vector<Render::Sampler*>& samplers( mRenderDataProvider->GetSamplers() );
+ std::vector<Render::Texture*>& textures( mRenderDataProvider->GetTextures() );
+ for( uint32_t i = 0; i < static_cast<uint32_t>( textures.size() ) && result; ++i ) // not expecting more than uint32_t of textures