Destroying Spotlight object affects other ofLight objects
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- computer-graphics
Research direction
Reproduce the issue using the ofApp.h and ofApp.cpp example, focusing on setSpotlight(), enable(), and spotlight.reset(). Trace ofLight's spotlight cleanup and verify that destroying the spotlight leaves directionalLight functional; done when the supplied directional-light draw continues to work after spotlight destruction.
Written by the indexing model from the issue text.
Description
Hi, I use openGL 2.1 and I learned that up to 8 instance of ofLight object can be used at once in this version.
So I tried to use and destroy ofLight instance and it seemed to be working well this way.
But today I found out that if I create and destroy ofLight instance which is set to spotlight, it caused other ofLight instances to not work properly.
Here's a simplified test code.
in ofApp.h,
unique_ptr<ofLight> directionalLight, spotlight;
in ofApp.cpp,
//--------------------------------------------------------------
void ofApp::setup(){
//directionalLight
directionalLight = make_unique<ofLight>();
directionalLight->setDirectional();
directionalLight->setOrientation(ofVec3f(0,120,0));
//spotlight
spotlight = make_unique<ofLight>();
//the following 3 lines below caused directionalLight to not work properly
//commenting out one of these makes it work again.
spotlight->setSpotlight();
spotlight->enable();
spotlight.reset();
ofEnableDepthTest();
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofGetGLRenderer()->enableLighting();
directionalLight->enable();
ofDrawSphere(ofGetWidth()/2, ofGetHeight()/2, ofGetHeight()/4);
directionalLight->disable();
ofGetGLRenderer()->disableLighting();
}
As it is stated in the code, destroying spotlight with .reset() causes directionalLight to not work properly even though one should not affect the other.
I tested this with pointLight, spotlight and directionalLight and destroying the spotlight only caused this issue.
So I'm pretty certain that this is a bug and I would appreciate if anyone can confirm this issue.
My testing was done with OF 0.9.8 on Mac OS X 10.11.6.
Thanks!
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
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.
More from openframeworks/openFrameworks
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
openframeworks/openFrameworks#6532 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openframeworks/openFrameworks#6380 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
openframeworks/openFrameworks#4817 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
openframeworks/openFrameworks#8553 · 1 comment ·
-
projectGenerator (vs): addon .c sources compiled as C++, causing unresolved externals (ofxLua: 55) Open
openframeworks/openFrameworks#8546 · 1 assignee ·
All issues in openframeworks/openFrameworks
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·