| 696 | } |
| 697 | |
| 698 | void GLES2RenderSystem::_setSampler(size_t unit, Sampler& sampler) |
| 699 | { |
| 700 | mStateCacheManager->activateGLTextureUnit(unit); |
| 701 | |
| 702 | GLenum target = mTextureTypes[unit]; |
| 703 | |
| 704 | const Sampler::UVWAddressingMode& uvw = sampler.getAddressingMode(); |
| 705 | |
| 706 | bool hasBorderClamp = hasMinGLVersion(3, 2) || checkExtension("GL_EXT_texture_border_clamp") || |
| 707 | checkExtension("GL_OES_texture_border_clamp"); |
| 708 | |
| 709 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_S, getTextureAddressingMode(uvw.u, hasBorderClamp)); |
| 710 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_T, getTextureAddressingMode(uvw.v, hasBorderClamp)); |
| 711 | if(getCapabilities()->hasCapability(RSC_TEXTURE_3D)) |
| 712 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_WRAP_R, getTextureAddressingMode(uvw.w, hasBorderClamp)); |
| 713 | |
| 714 | if ((uvw.u == TAM_BORDER || uvw.v == TAM_BORDER || uvw.w == TAM_BORDER) && hasBorderClamp) |
| 715 | OGRE_CHECK_GL_ERROR(glTexParameterfv( target, GL_TEXTURE_BORDER_COLOR_EXT, sampler.getBorderColour().ptr())); |
| 716 | |
| 717 | // only via shader.. |
| 718 | // OGRE_CHECK_GL_ERROR(glTexParameterf(target, GL_TEXTURE_LOD_BIAS, sampler.getTextureMipmapBias())); |
| 719 | |
| 720 | if (mCurrentCapabilities->hasCapability(RSC_ANISOTROPY)) |
| 721 | mStateCacheManager->setTexParameteri( |
| 722 | target, GL_TEXTURE_MAX_ANISOTROPY_EXT, |
| 723 | std::min<uint>(getCapabilities()->getMaxSupportedAnisotropy(), sampler.getAnisotropy())); |
| 724 | |
| 725 | if(hasMinGLVersion(3, 0)) |
| 726 | { |
| 727 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_COMPARE_MODE, |
| 728 | sampler.getCompareEnabled() ? GL_COMPARE_REF_TO_TEXTURE |
| 729 | : GL_NONE); |
| 730 | if(sampler.getCompareEnabled()) |
| 731 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, |
| 732 | convertCompareFunction(sampler.getCompareFunction())); |
| 733 | } |
| 734 | |
| 735 | // Combine with existing mip filter |
| 736 | mStateCacheManager->setTexParameteri( |
| 737 | target, GL_TEXTURE_MIN_FILTER, |
| 738 | getCombinedMinMipFilter(sampler.getFiltering(FT_MIN), sampler.getFiltering(FT_MIP))); |
| 739 | |
| 740 | switch (sampler.getFiltering(FT_MAG)) |
| 741 | { |
| 742 | case FO_ANISOTROPIC: // GL treats linear and aniso the same |
| 743 | case FO_LINEAR: |
| 744 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 745 | break; |
| 746 | case FO_POINT: |
| 747 | case FO_NONE: |
| 748 | mStateCacheManager->setTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 749 | break; |
| 750 | } |
| 751 | } |
| 752 | |
| 753 | void GLES2RenderSystem::_setLineWidth(float width) |
| 754 | { |
nothing calls this directly
no test coverage detected