Exemple #1
0
SequenceExporter::SequenceExporter( ID3D11Device* pDevice, int width, int height, QString prefix, QString extension, int startFrameIndex ) :

	m_width( width ),
	m_height( height ),
	m_frameIndex( startFrameIndex ),
	m_extension( extension ),
	m_builder( prefix, QString( "." ) + extension )
{

	if( extension == "png" )
	{
		m_pRT.reset( RenderTarget::createUnsignedByte4( pDevice, width, height ) );
		m_pStagingTexture.reset( StagingTexture2D::createUnsignedByte4( pDevice, width, height ) );
		m_image4ub = Image4ub( width, height );
	}
	else if( extension == "pfm" )
	{
		m_pRT.reset( RenderTarget::createFloat4( pDevice, width, height ) );
		m_pStagingTexture.reset( StagingTexture2D::createFloat4( pDevice, width, height ) );
		m_image4f = Image4f( width, height );
	}
	m_pDST.reset( DepthStencilTarget::createDepthFloat24StencilUnsignedByte8( pDevice, width, height ) );

	m_viewport = D3D11Utils::createViewport( width, height );

	pDevice->GetImmediateContext( &m_pImmediateContext );
}
void GLFrameBuffer::initialize(int w, int h) {
	if (context.get() == nullptr)throw std::runtime_error("Framebuffer has not been assigend a context.");
	context->begin(onScreen);
	if (mFrameBufferId != 0)
		glDeleteFramebuffers(1, &mFrameBufferId);
	if (mDepthBufferId != 0)
		glDeleteRenderbuffers(1, &mDepthBufferId);
	mFrameBufferId = 0;
	mDepthBufferId = 0;
	context->end();
	CHECK_GL_ERROR();
	texture.load(Image4f(w, h), false);
	CHECK_GL_ERROR();
	update();
}