openframeworks / openframeworks/openFrameworks
avoid having to have separate shaders for sampler2DRect and sampler2D
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Looking at the programmable renderer I wonder if there is a way to have a usingTexture2D flag passed through, in the same way we have a usingColors flag.
That way we would could have half as many frag shaders and people making general shaders for OF could support both texture types.
ie:
if( usingTexture2D ){
FRAG_COLOR = vec4(TEXTURE(src_tex_unit0_2D, texCoordVarying));
}else{
FRAG_COLOR = vec4(TEXTURE(src_tex_unit0, texCoordVarying));
}
If we wanted to get fancy we could even have a ofGetTexture glsl function ( as part of some OF glsl included functions ) which is inserted into the default shaders and any loaded shaders which you could use and it would internally figure out what texture type it is.
Curious what people think about this.
At the very least I think passing through whether a texture is 2D or 2DRect could be really useful.
ping @arturoc @tgfrerer @openframeworks/2d-3d
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 reading the programmable renderer's shader setup and the existing usingColors path, then compare how sampler2DRect and sampler2D fragment shaders are selected. Clarify whether the intended scope is a usingTexture2D flag, a shared ofGetTexture GLSL helper, or both, and verify support for both texture types with the renderer's shader paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100