openframeworks / openframeworks/openFrameworks
Who FBO and MRT suggestions?
Open
Nobody has claimed this yet.
core
feature
prelim-analysis
section-2D
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
The following usage is very cumbersome ...
I do not know how to optimize ...
ofFbo::Settings s;
s.width = img.getWidth();
s.height = img.getHeight();
s.internalformat = GL_LUMINANCE;
s.numColorbuffers = 7;
baseMaskFbo.allocate(s);
//////////////////////////////////////////////////////////////////////////
//MASK
//////////////////////////////////////////////////////////////////////////
baseMaskFbo.begin();
//Base
baseMaskShader.begin();
baseMaskShader.setUniform1f("blackBase",blackBase);
baseMaskShader.setUniform1f("whiteBase",whiteBase);
baseMaskShader.setUniform1f("strengthBaseMask",strengthBaseMask);
img.draw(0,0);
baseMaskShader.end();
//BLURX
blurXShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
blurXShader.setUniform1i("radius", blurRadiusBaseMask);
baseMaskFbo.getTextureReference(0).draw(0, 0);
blurXShader.end();
//BLURY
blurYShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT2_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
blurYShader.setUniform1i("radius", blurRadiusBaseMask);
baseMaskFbo.getTextureReference(1).draw(0, 0);
blurYShader.end();
//DILATEX
dilateXShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT3_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
dilateXShader.setUniform1i("radius", dilateRadiusBaseMask);
baseMaskFbo.getTextureReference(2).draw(0, 0);
dilateXShader.end();
//DILATEY
dilateYShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT4_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
dilateYShader.setUniform1i("radius", dilateRadiusBaseMask);
baseMaskFbo.getTextureReference(3).draw(0, 0);
dilateYShader.end();
//DILATEX
erodeXShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT5_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
erodeXShader.setUniform1i("radius", erodeRadiusBaseMask);
baseMaskFbo.getTextureReference(4).draw(0, 0);
erodeXShader.end();
//DILATEY
erodeYShader.begin();
glDrawBuffer(GL_COLOR_ATTACHMENT6_EXT); // write to this texture
ofClear(0, 0, 0, 0);
//ofSetColor(ofColor::white);
erodeYShader.setUniform1i("radius", erodeRadiusBaseMask);
baseMaskFbo.getTextureReference(5).draw(0, 0);
erodeYShader.end();
baseMaskFbo.end();
baseMaskFbo.getTextureReference(0).draw(0,0); //Base
baseMaskFbo.getTextureReference(2).draw(0,0); //Blur
baseMaskFbo.getTextureReference(4).draw(0,0); //Dilate
baseMaskFbo.getTextureReference(6).draw(0,0); //Erode
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the ofFbo::Settings allocation and the baseMaskFbo sequence using glDrawBuffer and getTextureReference in the provided example. The issue asks for usage or optimization guidance but names no target files, tests, or acceptance criteria, so the definition of done needs clarification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100