MCPcopy Create free account
hub / github.com/OGRECave/ogre / _setSampler

Method _setSampler

RenderSystems/GL/src/OgreGLRenderSystem.cpp:1332–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1330 }
1331
1332 void GLRenderSystem::_setSampler(size_t unit, Sampler& sampler)
1333 {
1334 mStateCacheManager->activateGLTextureUnit(unit);
1335
1336 GLenum target = mTextureTypes[unit];
1337
1338 const Sampler::UVWAddressingMode& uvw = sampler.getAddressingMode();
1339 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_S, getTextureAddressingMode(uvw.u));
1340 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_T, getTextureAddressingMode(uvw.v));
1341 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_R, getTextureAddressingMode(uvw.w));
1342
1343 if (uvw.u == TAM_BORDER || uvw.v == TAM_BORDER || uvw.w == TAM_BORDER)
1344 glTexParameterfv( target, GL_TEXTURE_BORDER_COLOR, sampler.getBorderColour().ptr());
1345
1346 if (mCurrentCapabilities->hasCapability(RSC_MIPMAP_LOD_BIAS))
1347 {
1348 glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, sampler.getMipmapBias());
1349 }
1350
1351 if (mCurrentCapabilities->hasCapability(RSC_ANISOTROPY))
1352 mStateCacheManager->setTexParameteri(
1353 target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
1354 std::min<uint>(mCurrentCapabilities->getMaxSupportedAnisotropy(), sampler.getAnisotropy()));
1355
1356 if(GLAD_GL_VERSION_2_0)
1357 {
1358 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_COMPARE_MODE,
1359 sampler.getCompareEnabled() ? GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT
1360 : GL_NONE);
1361 if (sampler.getCompareEnabled())
1362 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_COMPARE_FUNC,
1363 convertCompareFunction(sampler.getCompareFunction()));
1364 }
1365
1366 // Combine with existing mip filter
1367 mStateCacheManager->setTexParameteri(
1368 target, GL_TEXTURE_MIN_FILTER,
1369 getCombinedMinMipFilter(sampler.getFiltering(FT_MIN), sampler.getFiltering(FT_MIP)));
1370
1371 switch (sampler.getFiltering(FT_MAG))
1372 {
1373 case FO_ANISOTROPIC: // GL treats linear and aniso the same
1374 case FO_LINEAR:
1375 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1376 break;
1377 case FO_POINT:
1378 case FO_NONE:
1379 mStateCacheManager->setTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1380 break;
1381 }
1382 }
1383
1384 //-----------------------------------------------------------------------------
1385 void GLRenderSystem::_setTextureCoordSet(size_t stage, size_t index)

Callers 1

preRenderMethod · 0.45

Calls 7

getTextureAddressingModeFunction · 0.85
ptrMethod · 0.80
getCompareFunctionMethod · 0.80
getFilteringMethod · 0.80
getCombinedMinMipFilterFunction · 0.70
activateGLTextureUnitMethod · 0.45
setTexParameteriMethod · 0.45

Tested by

no test coverage detected