| 447 | } |
| 448 | |
| 449 | void OpenGlRenderer::setEffectTexture(String const& textureName, ImageView const& image) { |
| 450 | auto ptr = m_currentEffect->textures.ptr(textureName); |
| 451 | if (!ptr) |
| 452 | return; |
| 453 | |
| 454 | flushImmediatePrimitives(); |
| 455 | |
| 456 | if (!ptr->textureValue || ptr->textureValue->textureId == 0) { |
| 457 | ptr->textureValue = createGlTexture(image, ptr->textureAddressing, ptr->textureFiltering); |
| 458 | } else { |
| 459 | glBindTexture(GL_TEXTURE_2D, ptr->textureValue->textureId); |
| 460 | ptr->textureValue->textureSize = image.size; |
| 461 | uploadTextureImage(image.format, image.size, image.data); |
| 462 | } |
| 463 | |
| 464 | if (ptr->textureSizeUniform != -1) { |
| 465 | auto textureSize = ptr->textureValue->glTextureSize(); |
| 466 | glUniform2f(ptr->textureSizeUniform, textureSize[0], textureSize[1]); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | bool OpenGlRenderer::switchEffectConfig(String const& name) { |
| 471 | flushImmediatePrimitives(); |
no test coverage detected