------------------------------------------------------------------------------ Description: Perform rendering according to a render state \p s. \pre s_exists: s!=0
| 63 | // Perform rendering according to a render state \p s. |
| 64 | // \pre s_exists: s!=0 |
| 65 | void vtkFramebufferPass::Render(const vtkRenderState* s) |
| 66 | { |
| 67 | assert("pre: s_exists" && s != nullptr); |
| 68 | |
| 69 | vtkOpenGLClearErrorMacro(); |
| 70 | |
| 71 | this->NumberOfRenderedProps = 0; |
| 72 | |
| 73 | vtkRenderer* r = s->GetRenderer(); |
| 74 | vtkOpenGLRenderWindow* renWin = static_cast<vtkOpenGLRenderWindow*>(r->GetRenderWindow()); |
| 75 | vtkOpenGLState* ostate = renWin->GetState(); |
| 76 | |
| 77 | if (this->DelegatePass == nullptr) |
| 78 | { |
| 79 | vtkWarningMacro(<< " no delegate."); |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | // 1. Create a new render state with an FO. |
| 84 | if (s->GetFrameBuffer() == nullptr) |
| 85 | { |
| 86 | // get the viewport dimensions |
| 87 | r->GetTiledSizeAndOrigin( |
| 88 | &this->ViewportWidth, &this->ViewportHeight, &this->ViewportX, &this->ViewportY); |
| 89 | } |
| 90 | else |
| 91 | { |
| 92 | int size[2]; |
| 93 | s->GetWindowSize(size); |
| 94 | this->ViewportWidth = size[0]; |
| 95 | this->ViewportHeight = size[1]; |
| 96 | this->ViewportX = 0; |
| 97 | this->ViewportY = 0; |
| 98 | } |
| 99 | |
| 100 | this->ColorTexture->SetContext(renWin); |
| 101 | if (!this->ColorTexture->GetHandle()) |
| 102 | { |
| 103 | if (this->ColorFormat == vtkTextureObject::Float16) |
| 104 | { |
| 105 | this->ColorTexture->SetInternalFormat(GL_RGBA16F); |
| 106 | this->ColorTexture->SetDataType(GL_FLOAT); |
| 107 | } |
| 108 | if (this->ColorFormat == vtkTextureObject::Float32) |
| 109 | { |
| 110 | this->ColorTexture->SetInternalFormat(GL_RGBA32F); |
| 111 | this->ColorTexture->SetDataType(GL_FLOAT); |
| 112 | } |
| 113 | this->ColorTexture->Create2D( |
| 114 | this->ViewportWidth, this->ViewportHeight, 4, VTK_UNSIGNED_CHAR, false); |
| 115 | } |
| 116 | this->ColorTexture->Resize(this->ViewportWidth, this->ViewportHeight); |
| 117 | |
| 118 | // Depth texture |
| 119 | this->DepthTexture->SetContext(renWin); |
| 120 | if (!this->DepthTexture->GetHandle()) |
| 121 | { |
| 122 | this->DepthTexture->AllocateDepth(this->ViewportWidth, this->ViewportHeight, this->DepthFormat); |
nothing calls this directly
no test coverage detected