History

make TextureCache work with DependancyManager

ZappoMan committed 11 years ago

Commit 7d75d2d1 parent c6b033f13 files · +70 −78Browse files

Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all

Unified · Split

interface/src/Application.cpp+9−9
@@ -620,10 +620,10 @@ void Application::paintGL() { · 619 unmodified lines
620 // Set the desired FBO texture size. If it hasn't changed, this does nothing.620 // Set the desired FBO texture size. If it hasn't changed, this does nothing.
621 // Otherwise, it must rebuild the FBOs621 // Otherwise, it must rebuild the FBOs
622 if (OculusManager::isConnected()) {622 if (OculusManager::isConnected()) {
623 TextureCache::getInstance()->setFrameBufferSize(OculusManager::getRenderTargetSize());623 DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize());
624 } else {624 } else {
625 QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();625 QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
626 TextureCache::getInstance()->setFrameBufferSize(fbSize);626 DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
627 }627 }
628 628
629 glEnable(GL_LINE_SMOOTH);629 glEnable(GL_LINE_SMOOTH);
@@ -713,7 +713,7 @@ void Application::paintGL() { · 83 unmodified lines
713 _glowEffect.prepare();713 _glowEffect.prepare();
714 714
715 // Viewport is assigned to the size of the framebuffer715 // Viewport is assigned to the size of the framebuffer
716 QSize size = TextureCache::getInstance()->getPrimaryFramebufferObject()->size();716 QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size();
717 glViewport(0, 0, size.width(), size.height());717 glViewport(0, 0, size.width(), size.height());
718 718
719 glMatrixMode(GL_MODELVIEW);719 glMatrixMode(GL_MODELVIEW);
@@ -2043,7 +2043,7 @@ void Application::init() { · 1323 unmodified lines
2043 connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);2043 connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
2044 2044
2045 // make sure our texture cache knows about window size changes 2045 // make sure our texture cache knows about window size changes
2046 TextureCache::getInstance()->associateWithWidget(getGLWidget());2046 DependencyManager::get<TextureCache>()->associateWithWidget(getGLWidget());
2047}2047}
2048 2048
2049void Application::closeMirrorView() {2049void Application::closeMirrorView() {
@@ -2774,7 +2774,7 @@ glm::vec3 Application::getSunDirection() { · 724 unmodified lines
2774 2774
2775void Application::updateShadowMap() {2775void Application::updateShadowMap() {
2776 PerformanceTimer perfTimer("shadowMap");2776 PerformanceTimer perfTimer("shadowMap");
2777 QOpenGLFramebufferObject* fbo = TextureCache::getInstance()->getShadowFramebufferObject();2777 QOpenGLFramebufferObject* fbo = DependencyManager::get<TextureCache>()->getShadowFramebufferObject();
2778 fbo->bind();2778 fbo->bind();
2779 glEnable(GL_DEPTH_TEST);2779 glEnable(GL_DEPTH_TEST);
2780 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);2780 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -2939,7 +2939,7 @@ void Application::setupWorldLight() { · 158 unmodified lines
2939}2939}
2940 2940
2941QImage Application::renderAvatarBillboard() {2941QImage Application::renderAvatarBillboard() {
2942 TextureCache::getInstance()->getPrimaryFramebufferObject()->bind();2942 DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
2943 2943
2944 // the "glow" here causes an alpha of one2944 // the "glow" here causes an alpha of one
2945 Glower glower;2945 Glower glower;
@@ -2950,7 +2950,7 @@ QImage Application::renderAvatarBillboard() { · 4 unmodified lines
2950 QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);2950 QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
2951 glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());2951 glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
2952 2952
2953 TextureCache::getInstance()->getPrimaryFramebufferObject()->release();2953 DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->release();
2954 2954
2955 return image;2955 return image;
2956}2956}
@@ -3301,12 +3301,12 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 344 unmodified lines
3301 3301
3302 // set the bounds of rear mirror view3302 // set the bounds of rear mirror view
3303 if (billboard) {3303 if (billboard) {
3304 QSize size = TextureCache::getInstance()->getFrameBufferSize();3304 QSize size = DependencyManager::get<TextureCache>()->getFrameBufferSize();
3305 glViewport(region.x(), size.height() - region.y() - region.height(), region.width(), region.height());3305 glViewport(region.x(), size.height() - region.y() - region.height(), region.width(), region.height());
3306 glScissor(region.x(), size.height() - region.y() - region.height(), region.width(), region.height()); 3306 glScissor(region.x(), size.height() - region.y() - region.height(), region.width(), region.height());
3307 } else {3307 } else {
3308 // if not rendering the billboard, the region is in device independent coordinates; must convert to device3308 // if not rendering the billboard, the region is in device independent coordinates; must convert to device
3309 QSize size = TextureCache::getInstance()->getFrameBufferSize();3309 QSize size = DependencyManager::get<TextureCache>()->getFrameBufferSize();
3310 float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale();3310 float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale();
3311 int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;3311 int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;
3312 glViewport(x, size.height() - y - height, width, height);3312 glViewport(x, size.height() - y - height, width, height);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t