@cuinjune wrote:
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
spotlightonly 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!
Posts: 1
Participants: 1