OF_FBOMODE_NODEFAULTS doesn't set identity matrices

Open
#7,998 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start by tracing the fbo.begin(OF_FBOMODE_NODEFAULTS) and fbo.end() entry points, then inspect how the projection and modelview matrices are handled during the FBO draw. Reproduce the example with ofClear, ofSetColor, and ofDrawRectangle, and compare it with the version using ofLoadIdentityMatrix. Done means the first example produces the stated view and square without manually loading identity matrices.

Written by the indexing model from the issue text.

Description

The below code should create a view from [-1, -1] to [1, 1] and draw a square in the upper right quadrant...

 fbo.begin(OF_FBOMODE_NODEFAULTS);
 ofClear(0, 255);
 ofSetColor(255);
 ofDrawRectangle(0, 0, 1, 1);
 fbo.end();

However, to get it to actually to actually do that, I needed to explicitly load the identity matrices...

fbo.begin(OF_FBOMODE_NODEFAULTS);
ofSetMatrixMode(OF_MATRIX_PROJECTION);
ofPushMatrix();
ofLoadIdentityMatrix();
ofSetMatrixMode(OF_MATRIX_MODELVIEW);
ofPushMatrix();
ofLoadIdentityMatrix();
ofClear(0, 255);
ofSetColor(255);
ofDrawRectangle(0, 0, 1, 1);
ofSetMatrixMode(OF_MATRIX_PROJECTION);
ofPopMatrix();
ofSetMatrixMode(OF_MATRIX_MODELVIEW);
ofPopMatrix();
fbo.end();
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openframeworks/openFrameworks

All issues in openframeworks/openFrameworks

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.