Hello,
I’m building a wordcloud in a 3D space but the text doesn’t seem to be opaque when it’s in front of other text.
struct Word {
string text;
float val;
int pos_x;
int pos_y;
int pos_z;
} ;
std::vector <Word> words;
ofTrueTypeFont font;
ofEasyCam cam;
void ofApp::setup(){
font.load("font.ttf", 100);
for(int i = 0; i < 7500; i++){
Word word;
word.text = "test";
word.val = ofRandom(-1.0,1.0);
word.pos_x = ofRandom(-2000,2000);
word.pos_y = ofRandom(-2000,20000);
word.pos_z = ofRandom(-6000,2000);
words.push_back(word);
}
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofBackground(0);
cam.begin();
for (Word & word : words) {
if(word.val >= 0.0)
ofSetColor(255, 0, 0, 255);
else
ofSetColor(0, 255, 0, 255);
ofPushMatrix();
ofTranslate(word.pos_x,word.pos_y,word.pos_z);
font.drawString(word.text, 0, 0);
ofPopMatrix();
}
cam.end();
}
Thanks,
Joan