------------------------------------------------------------------------------
| 512 | |
| 513 | //------------------------------------------------------------------------------ |
| 514 | void vtkTextureObject::SendParameters() |
| 515 | { |
| 516 | assert("pre: is_bound" && this->IsBound()); |
| 517 | |
| 518 | #if defined(GL_TEXTURE_BUFFER) |
| 519 | if (this->Target == GL_TEXTURE_BUFFER) |
| 520 | { |
| 521 | return; |
| 522 | } |
| 523 | #endif |
| 524 | |
| 525 | #ifdef glTexImage2DMultisample |
| 526 | if (this->Target == GL_TEXTURE_2D_MULTISAMPLE) |
| 527 | { |
| 528 | return; |
| 529 | } |
| 530 | #endif |
| 531 | |
| 532 | glTexParameteri(this->Target, GL_TEXTURE_WRAP_S, OpenGLWrap[this->WrapS]); |
| 533 | glTexParameteri(this->Target, GL_TEXTURE_WRAP_T, OpenGLWrap[this->WrapT]); |
| 534 | |
| 535 | #ifdef GL_TEXTURE_WRAP_R |
| 536 | glTexParameteri(this->Target, GL_TEXTURE_WRAP_R, OpenGLWrap[this->WrapR]); |
| 537 | #endif |
| 538 | |
| 539 | #ifdef __EMSCRIPTEN__ |
| 540 | // Web browsers are over-eager in validating texture completeness. |
| 541 | // Even though spec says that depth textures can be filterable by treating |
| 542 | // them as red textures, browsers do not seem to implement it. |
| 543 | // This section of code ignores requests to enable linear filtering for depth textures. Otherwise, |
| 544 | // 1. In firefox, sampling this texture in a shader will return 0 and console throws a warning |
| 545 | // saying that texture is incomplete. |
| 546 | // 2. In chromium, this texture cannot be sampled. |
| 547 | // See https://groups.google.com/g/webgl-dev-list/c/T4_bKNzEhqk |
| 548 | if (this->Format == GL_DEPTH_COMPONENT) |
| 549 | { |
| 550 | if (this->MinificationFilter != Nearest && this->MinificationFilter != NearestMipmapNearest) |
| 551 | { |
| 552 | vtkDebugMacro(<< "Ignoring request to enable linear minification filtering for texture with " |
| 553 | "format=GL_DEPTH_COMPONENT"); |
| 554 | } |
| 555 | else |
| 556 | { |
| 557 | glTexParameteri( |
| 558 | this->Target, GL_TEXTURE_MIN_FILTER, OpenGLMinFilter[this->MinificationFilter]); |
| 559 | } |
| 560 | if (this->MagnificationFilter != Nearest && this->MagnificationFilter != NearestMipmapNearest) |
| 561 | { |
| 562 | vtkDebugMacro(<< "Ignoring request to enable linear magnification filtering for texture with " |
| 563 | "format=GL_DEPTH_COMPONENT"); |
| 564 | } |
| 565 | else |
| 566 | { |
| 567 | glTexParameteri( |
| 568 | this->Target, GL_TEXTURE_MAG_FILTER, OpenGLMagFilter[this->MagnificationFilter]); |
| 569 | } |
| 570 | } |
| 571 | else |
no test coverage detected