mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 18:59:59 +01:00
Bugfix attach source
This commit is contained in:
34
Source.cpp
34
Source.cpp
@@ -492,13 +492,19 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
delete renderbuffer_;
|
delete renderbuffer_;
|
||||||
renderbuffer_ = renderbuffer;
|
renderbuffer_ = renderbuffer;
|
||||||
|
|
||||||
// only first time initialization
|
// create rendersurface_ only once
|
||||||
if ( mode_ == UNINITIALIZED ) {
|
if ( rendersurface_ == nullptr) {
|
||||||
|
|
||||||
// create the surfaces to draw the frame buffer in the views
|
// create the surfaces to draw the frame buffer in the views
|
||||||
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
|
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
|
||||||
groups_[View::RENDERING]->attach(rendersurface_);
|
groups_[View::RENDERING]->attach(rendersurface_);
|
||||||
groups_[View::GEOMETRY]->attach(rendersurface_);
|
groups_[View::GEOMETRY]->attach(rendersurface_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rendersurface_->setFrameBuffer(renderbuffer_);
|
||||||
|
|
||||||
|
// create mixingsurface_ only once
|
||||||
|
if ( mixingsurface_ == nullptr) {
|
||||||
|
|
||||||
// for mixing and layer views, add another surface to overlay
|
// for mixing and layer views, add another surface to overlay
|
||||||
// (stippled view on top with transparency)
|
// (stippled view on top with transparency)
|
||||||
@@ -506,6 +512,16 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
groups_[View::MIXING]->attach(mixingsurface_);
|
groups_[View::MIXING]->attach(mixingsurface_);
|
||||||
groups_[View::LAYER]->attach(mixingsurface_);
|
groups_[View::LAYER]->attach(mixingsurface_);
|
||||||
|
|
||||||
|
// Transition group node is optionnal
|
||||||
|
if (groups_[View::TRANSITION]->numChildren() > 0)
|
||||||
|
groups_[View::TRANSITION]->attach(mixingsurface_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mixingsurface_->setFrameBuffer(renderbuffer_);
|
||||||
|
|
||||||
|
// create activesurface_ only once (and other initializations done once)
|
||||||
|
if ( activesurface_ == nullptr) {
|
||||||
|
|
||||||
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
||||||
activesurface_ = new Surface();
|
activesurface_ = new Surface();
|
||||||
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||||
@@ -513,10 +529,6 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
groups_[View::MIXING]->attach(activesurface_);
|
groups_[View::MIXING]->attach(activesurface_);
|
||||||
groups_[View::LAYER]->attach(activesurface_);
|
groups_[View::LAYER]->attach(activesurface_);
|
||||||
|
|
||||||
// Transition group node is optionnal
|
|
||||||
if (groups_[View::TRANSITION]->numChildren() > 0)
|
|
||||||
groups_[View::TRANSITION]->attach(mixingsurface_);
|
|
||||||
|
|
||||||
// if a symbol is available, add it to overlay
|
// if a symbol is available, add it to overlay
|
||||||
if (symbol_) {
|
if (symbol_) {
|
||||||
overlays_[View::MIXING]->attach( symbol_ );
|
overlays_[View::MIXING]->attach( symbol_ );
|
||||||
@@ -529,12 +541,6 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
groups_[View::GEOMETRY]->attach( locker_ );
|
groups_[View::GEOMETRY]->attach( locker_ );
|
||||||
groups_[View::TEXTURE]->attach( locker_ );
|
groups_[View::TEXTURE]->attach( locker_ );
|
||||||
|
|
||||||
// make the source visible
|
|
||||||
setMode(VISIBLE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rendersurface_->setFrameBuffer(renderbuffer_);
|
|
||||||
mixingsurface_->setFrameBuffer(renderbuffer_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a symbol is available
|
// if a symbol is available
|
||||||
@@ -560,6 +566,10 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
delete maskbuffer_;
|
delete maskbuffer_;
|
||||||
maskbuffer_ = new FrameBuffer( glm::vec3(0.5) * renderbuffer->resolution() );
|
maskbuffer_ = new FrameBuffer( glm::vec3(0.5) * renderbuffer->resolution() );
|
||||||
|
|
||||||
|
// make the source visible
|
||||||
|
if ( mode_ == UNINITIALIZED )
|
||||||
|
setMode(VISIBLE);
|
||||||
|
|
||||||
// request update
|
// request update
|
||||||
need_update_ = true;
|
need_update_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user