openframeworks / openframeworks/openFrameworks

need to set MatrixMode in ofNode and of3dGraphics draw functions

Open
#2,828 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core feature section-3D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

the draw functions should set the MatrixMode to OF_MATRIX_MODELVIEW before they perform their matrix operations and then set the MatrixMode back to whatever was the previous Matrix Mode before the draw call;

Right now the user must do this to use ofDrawBox.

    ofSetMatrixMode(OF_MATRIX_TEXTURE);
    ofPushMatrix();
    ofTranslate(0, 1.0);
    ofScale(1.0, -1.0);
    ofSetMatrixMode(OF_MATRIX_MODELVIEW);
    ofDrawBox(100.0);
    ofSetMatrixMode(OF_MATRIX_TEXTURE);
    ofPopMatrix();

Notice the 3 calls to ofSetMatrixMode.
It should look like this with just one call to ofSetMatrixMode

    ofSetMatrixMode(OF_MATRIX_TEXTURE);
    ofPushMatrix();
    ofTranslate(0, 1.0);
    ofScale(1.0, -1.0);
    ofDrawBox(100.0);
    ofPopMatrix();

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.

Research direction

Locate the ofNode and of3dGraphics draw functions that perform matrix operations, then inspect how they use ofSetMatrixMode, ofPushMatrix, and ofPopMatrix. Verify that each draw call temporarily uses OF_MATRIX_MODELVIEW and restores the caller's previous matrix mode, including the texture-mode example shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.