openframeworks / openframeworks/openFrameworks
ofSize
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
There was already a thread on ofSize, it's a few years old and the context of my throughs is a bit different.
https://github.com/openframeworks/openFrameworks/pull/1926
I noticed in my projects that I often use many variables for many projector or display sizes, mostly in pixels:
int projectorWidth = 42;
int projectorHeight = 42;
int displayWidth = 42;
int displayHeight = 42;
…
I wanted a better solution and started using ofPoint or ofVec2f. But it still doesn't feel right.
First of all you access it with .x and .y instead of .width and .height. And it uses floats instead of ints. Maybe ofSizei and ofSizef would be even useful to indicate what it's used for. I'm aware that ofSizei looks weird.
Such a type could not only be useful in projects where width and height is used but also by oF itself for example we could transform this:
void ofFbo::allocate(int width, int height, int internalformat, int numSamples)
to this:
void ofFbo::allocate(ofSize size, int internalformat, int numSamples)
I think this would make code cleaner, easier to read and understand.
ofSize projectorSize = ofSize(42, 42);
ofSize displaySize = ofSize(42, 42);
Any thoughts on this?
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 reviewing the older ofSize discussion in pull request #1926 and the proposed ofSize/ofSizei/ofSizef API in this issue. Examine the existing ofFbo::allocate(int width, int height, int internalformat, int numSamples) entry point; done would require a decided size-type design and an agreed scope for adopting it.
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
- 25/100