Beispiel #1
0
void TV3DManager::connect() {
    auto glCanvas = Application::getInstance()->getGLWidget();
    int width = glCanvas->getDeviceWidth();
    int height = glCanvas->getDeviceHeight();
    Camera& camera = *Application::getInstance()->getCamera();

    configureCamera(camera, width, height);
}
Beispiel #2
0
static void _suspend_backup_screen()
{
	IBitmap* pDeviceBitmap;
	IDISPLAY_GetDeviceBitmap(BFF_DISPLAY(),&pDeviceBitmap);
	IBITMAP_CreateCompatibleBitmap( pDeviceBitmap, &GetMainAppData()->pScreenBackup, getDeviceWidth(), getDeviceHeight());
	IBITMAP_BltIn( GetMainAppData()->pScreenBackup, 0, 0, getDeviceWidth(),getDeviceHeight(), pDeviceBitmap, 0, 0, AEE_RO_COPY );
	IBITMAP_Release( pDeviceBitmap );
}
Beispiel #3
0
static boolean task_resume(Bff *bff, uint16 flags, AEEAppStart *appStart, boolean *consumed)
{
	if(GetMainAppData()->pScreenBackup)
	{
		IDISPLAY_ClearScreen(BFF_DISPLAY());
		IDISPLAY_BitBlt(BFF_DISPLAY(),0,0,getDeviceWidth(),getDeviceHeight(),GetMainAppData()->pScreenBackup,0,0,AEE_RO_COPY);
		IDISPLAY_Update(BFF_DISPLAY());
		IBITMAP_Release(GetMainAppData()->pScreenBackup);
		GetMainAppData()->pScreenBackup = NULL;
	}
	return (*consumed = TRUE);
}
Beispiel #4
0
QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
    PerformanceTimer perfTimer("glowEffect");

    auto textureCache = DependencyManager::get<TextureCache>();
    QOpenGLFramebufferObject* primaryFBO = textureCache->getPrimaryFramebufferObject();
    primaryFBO->release();
    glBindTexture(GL_TEXTURE_2D, primaryFBO->texture());

    glPushMatrix();
    glLoadIdentity();
    
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    
    glDisable(GL_BLEND);
    glDisable(GL_DEPTH_TEST);
    glDepthMask(GL_FALSE);

    QOpenGLFramebufferObject* destFBO = toTexture ?
        textureCache->getSecondaryFramebufferObject() : NULL;
    if (!_enabled || _isEmpty) {
        // copy the primary to the screen
        if (destFBO && QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
            QOpenGLFramebufferObject::blitFramebuffer(destFBO, primaryFBO);
        } else {
            maybeBind(destFBO);
            if (!destFBO) {
                glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
            }
            glEnable(GL_TEXTURE_2D);
            glDisable(GL_LIGHTING);
            renderFullscreenQuad();
            glDisable(GL_TEXTURE_2D);
            glEnable(GL_LIGHTING);
            maybeRelease(destFBO);
        }
    } else {
        // diffuse into the secondary/tertiary (alternating between frames)
        QOpenGLFramebufferObject* oldDiffusedFBO =
            textureCache->getSecondaryFramebufferObject();
        QOpenGLFramebufferObject* newDiffusedFBO =
            textureCache->getTertiaryFramebufferObject();
        if (_isOddFrame) {
            qSwap(oldDiffusedFBO, newDiffusedFBO);
        }
        newDiffusedFBO->bind();
        
        if (_isFirstFrame) {
            glClear(GL_COLOR_BUFFER_BIT);    
            
        } else {
            glActiveTexture(GL_TEXTURE1);
            glBindTexture(GL_TEXTURE_2D, oldDiffusedFBO->texture());
            
            _diffuseProgram->bind();
            QSize size = primaryFBO->size();
            _diffuseProgram->setUniformValue(_diffusionScaleLocation, 1.0f / size.width(), 1.0f / size.height());
        
            renderFullscreenQuad();
        
            _diffuseProgram->release();
        }
        
        newDiffusedFBO->release();
        
        // add diffused texture to the primary
        glBindTexture(GL_TEXTURE_2D, newDiffusedFBO->texture());
        
        if (toTexture) {
            destFBO = oldDiffusedFBO;
        }
        maybeBind(destFBO);
        if (!destFBO) {
            glViewport(0, 0, getDeviceWidth(), getDeviceHeight());
        }
        _addSeparateProgram->bind();
        renderFullscreenQuad();
        _addSeparateProgram->release();
        maybeRelease(destFBO);
        
        glBindTexture(GL_TEXTURE_2D, 0);
        glActiveTexture(GL_TEXTURE0);
        
    }
    
    glPopMatrix();
    
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
       
    glEnable(GL_BLEND);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glBindTexture(GL_TEXTURE_2D, 0);
    
    _isFirstFrame = false;
    
    return destFBO;
}