Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 4 files). Show all
Unified · Split
| @@ -64,12 +64,11 @@ GLuint TextureCache::getPermutationNormalTextureID() { · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | QOpenGLFramebufferObject* TextureCache::getPrimaryFramebufferObject() { | 65 | QOpenGLFramebufferObject* TextureCache::getPrimaryFramebufferObject() { |
| 66 | if (_primaryFramebufferObject == NULL) { | 66 | if (_primaryFramebufferObject == NULL) { |
| 67 | QSize size = Application::getInstance()->getGLWidget()->size(); | 67 | _primaryFramebufferObject = createFramebufferObject(); |
| 68 | _primaryFramebufferObject = new QOpenGLFramebufferObject(size); | 68 | |
| 69 | Application::getInstance()->getGLWidget()->installEventFilter(this); | ||
| 70 | |||
| 71 | glGenTextures(1, &_primaryDepthTextureID); | 69 | glGenTextures(1, &_primaryDepthTextureID); |
| 72 | glBindTexture(GL_TEXTURE_2D, _primaryDepthTextureID); | 70 | glBindTexture(GL_TEXTURE_2D, _primaryDepthTextureID); |
| 71 | QSize size = Application::getInstance()->getGLWidget()->size(); | ||
| 73 | glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, size.width(), size.height(), | 72 | glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, size.width(), size.height(), |
| 74 | 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); | 73 | 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); |
| 75 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 74 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| @@ -91,16 +90,14 @@ GLuint TextureCache::getPrimaryDepthTextureID() { · 15 unmodified lines | |||
| 91 | 90 | ||
| 92 | QOpenGLFramebufferObject* TextureCache::getSecondaryFramebufferObject() { | 91 | QOpenGLFramebufferObject* TextureCache::getSecondaryFramebufferObject() { |
| 93 | if (_secondaryFramebufferObject == NULL) { | 92 | if (_secondaryFramebufferObject == NULL) { |
| 94 | _secondaryFramebufferObject = new QOpenGLFramebufferObject(Application::getInstance()->getGLWidget()->size()); | 93 | _secondaryFramebufferObject = createFramebufferObject(); |
| 95 | Application::getInstance()->getGLWidget()->installEventFilter(this); | ||
| 96 | } | 94 | } |
| 97 | return _secondaryFramebufferObject; | 95 | return _secondaryFramebufferObject; |
| 98 | } | 96 | } |
| 99 | 97 | ||
| 100 | QOpenGLFramebufferObject* TextureCache::getTertiaryFramebufferObject() { | 98 | QOpenGLFramebufferObject* TextureCache::getTertiaryFramebufferObject() { |
| 101 | if (_tertiaryFramebufferObject == NULL) { | 99 | if (_tertiaryFramebufferObject == NULL) { |
| 102 | _tertiaryFramebufferObject = new QOpenGLFramebufferObject(Application::getInstance()->getGLWidget()->size()); | 100 | _tertiaryFramebufferObject = createFramebufferObject(); |
| 103 | Application::getInstance()->getGLWidget()->installEventFilter(this); | ||
| 104 | } | 101 | } |
| 105 | return _tertiaryFramebufferObject; | 102 | return _tertiaryFramebufferObject; |
| 106 | } | 103 | } |
| @@ -124,3 +121,15 @@ bool TextureCache::eventFilter(QObject* watched, QEvent* event) { · 17 unmodified lines | |||
| 124 | } | 121 | } |
| 125 | return false; | 122 | return false; |
| 126 | } | 123 | } |
| 124 | |||
| 125 | QOpenGLFramebufferObject* TextureCache::createFramebufferObject() { | ||
| 126 | QOpenGLFramebufferObject* fbo = new QOpenGLFramebufferObject(Application::getInstance()->getGLWidget()->size()); | ||
| 127 | Application::getInstance()->getGLWidget()->installEventFilter(this); | ||
| 128 | |||
| 129 | glBindTexture(GL_TEXTURE_2D, fbo->texture()); | ||
| 130 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
| 131 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||
| 132 | glBindTexture(GL_TEXTURE_2D, 0); | ||
| 133 | |||
| 134 | return fbo; | ||
| 135 | } | ||