@kotaonaga wrote:
Hi, I am trying to use
vector<ofColor>
, but I gotEXC_BAD_ACCESS
. Xcode says Build Succeeded.
How do I usevector<ofColor>
withsetHsb
properly?
Why does this error occur?This is where
EXC_BAD_ACCESS
showed up.
This is my code:
ofApp.h:
vector<ofColor> colors;
ofApp.cpp
void ofApp::setup(){ ofColor color; for(int i = 0; i < colors.size(); i++){ color.setHsb(i * 50, 222, 255); colors.push_back(color); } } void ofApp::draw(){ ofBackground(250); ofSetColor(colors[0]); ofDrawCircle(300, 300, 100); }
Thank you!
Posts: 3
Participants: 2