| 561 | } |
| 562 | |
| 563 | TextureGroupPtr OpenGlRenderer::createTextureGroup(TextureGroupSize textureSize, TextureFiltering filtering) { |
| 564 | int maxTextureSize; |
| 565 | glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); |
| 566 | maxTextureSize = min(maxTextureSize, (2 << 14)); |
| 567 | // Large texture sizes are not always supported |
| 568 | if (textureSize == TextureGroupSize::Large && (m_limitTextureGroupSize || maxTextureSize < 4096)) |
| 569 | textureSize = TextureGroupSize::Medium; |
| 570 | |
| 571 | unsigned atlasNumCells; |
| 572 | if (textureSize == TextureGroupSize::Large) |
| 573 | atlasNumCells = 256; |
| 574 | else if (textureSize == TextureGroupSize::Medium) |
| 575 | atlasNumCells = 128; |
| 576 | else // TextureGroupSize::Small |
| 577 | atlasNumCells = 64; |
| 578 | |
| 579 | Logger::info("detected supported OpenGL texture size {}, using atlasNumCells {}", maxTextureSize, atlasNumCells); |
| 580 | |
| 581 | auto glTextureGroup = make_shared<GlTextureGroup>(atlasNumCells); |
| 582 | glTextureGroup->textureAtlasSet.textureFiltering = filtering; |
| 583 | m_liveTextureGroups.append(glTextureGroup); |
| 584 | return glTextureGroup; |
| 585 | } |
| 586 | |
| 587 | RenderBufferPtr OpenGlRenderer::createRenderBuffer() { |
| 588 | return createGlRenderBuffer(); |
no test coverage detected