@sterlingcrispin wrote:
I want to write 2D text in relation to some point in 3D space, in screenspace. I'm having some weird terrible time doing this with openframeworks. Maybe I'm missing something?
this works fine
ofCamera cam; float Z; void ofApp::setup(){ Z = 0; } void ofApp::update(){ } void ofApp::draw(){ Z += 0.1; cam.setPosition(0,0,Z); cam.begin(); ofSpherePrimitive sphere; sphere.drawWireframe(); for(int i = 0; i < sphere.getMesh().getVertices().size(); i ++){ ofVec3f loc = sphere.getMesh().getVertex(i); ofDrawBitmapString( ofToString( sphere.getMesh().getIndex(i) ), loc.x, loc.y, loc.z ); } cam.end(); }
however if I change the for loop to this, its totally ruined
for(int i = 0; i < sphere.getMesh().getVertices().size(); i ++){ ofVec3f loc = cam.worldToScreen( sphere.getMesh().getVertex(i) ); ofDrawBitmapString( ofToString( sphere.getMesh().getIndex(i) ), loc.x, loc.y); }
Why wouldn't this work?
I'm actually trying to build a much more complex application that uses ofEasyCam and the ofTrueTypeFont but I tried to use the ofEasyCam with the pointPickerExample and it seems like ofEasyCam and WorldToScreen don't work properly together.
do I need to force the camera to have some transformation matrix applied to it before I ask for worldToScreen ?
Posts: 2
Participants: 2