openframeworks / openframeworks/openFrameworks

GLFW Window not initially cleared when ofSetBackgroundAuto() is false (Linux)

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

Nobody has claimed this yet.

bitesize bug core prelim-analysis section-2D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

I'm doing the following in setup():

ofSetBackgroundAuto(false);
ofBackground(255,255,255);

This does not clear the background to white as it should.

I made a modification to ofAppGLFWWindow::display() which fixed it but I don't exactly understand the cause of this.

The relevant code is:

    if (bClearAuto == false){
        // in accum mode resizing a window is BAD, so we clear on resize events.
        if (nFramesSinceWindowResized < 3){
            ofClear(bgPtr[0]*255,bgPtr[1]*255,bgPtr[2]*255, bgPtr[3]*255);
        }
    }

By changing it to nFramesSinceWindowResized < 5 everything worked as it should.
Is this a driver specific or windowing specific bug? Anyone know why that number is 3 in the first place?

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

Start at the ofAppGLFWWindow::display() entry point and inspect how nFramesSinceWindowResized controls clearing when bClearAuto is false. Reproduce the setup on Linux and verify that the initial window background becomes white without changing the intended resize behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.