MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / setEffectTexture

Method setEffectTexture

source/application/StarRenderer_opengl.cpp:449–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449void 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
470bool OpenGlRenderer::switchEffectConfig(String const& name) {
471 flushImmediatePrimitives();

Callers 1

renderMethod · 0.80

Calls 2

glTextureSizeMethod · 0.80
ptrMethod · 0.45

Tested by

no test coverage detected