I am trying to place some text information on a window (along with some graphics).
I need to update this information (as in overwrite it), but “drawString” does not work as I expected.
Suppose my text starts as 123456 and I want it updated to 654321.
What I get is 123456654321, even though the drawString position (x, y) parameters do not change.
I have of_v0.8.4_osx_release installed, OS X 10.9, Xcode 6.1.1.
I have a bunch of warnings (see below) but I don’t think they are causing the problem…?
Messages
Deprecations:
/Users/…/openFrameworks/libs/openFrameworks/gl/ofTexture.cpp:567:5: ‘gluBuild2DMipmaps’ is deprecated: first deprecated in OS X 10.9 - “Use glGenerateMipmap”
warning directive
/Users/…/openFrameworks/libs/openFrameworks/video/ofQTKitGrabber.mm:18:3: Using QTKit, which is deprecated in OSX 10.9
Semantic issue:
/Users/…/openFrameworks/libs/openFrameworks/video/ofQTKitMovieRenderer.m:87:18: Incompatible pointer types assigning to ‘NSString *’ from ‘NSURL *’
@nandomtl
please include some code so that we can see what you’re doing.
it is possible that you’re not clearing the string before updating it to a new value?
you can also debug the string in code using ofLog:
ofLogNotice() << "string: " << myString;
I haven’t found the source of the issue yet, but I believe it is being caused by some ofPushMatrix / ofPopMatrix statements I have (see below).
The complete code (.h and .cpp code in one RTF file) can be found here:
Thank you for your interest
…
//Draw the second hand ---------------------------------------
ofPushMatrix(); // save coordinate system
ofSetColor(255,0,0);
ofRotateZ( secondsAngle );
ofFill();
ofRect( -((radius/100)*2),-((radius/100)*2),(radius/10)*9, (radius/100)*4 );
ofPopMatrix(); // restore coordinate system
//Write the time with characters -----------------------------
ofPushMatrix(); // save coordinate system
ofRotateZ( 90 );
ofSetColor(0,79,223); // blue-ish
myfont.drawString( mytime, -100, 40);
ofPopMatrix(); // restore coordinate system
Problem found, located between the screen and the chair…
This statement:
mytime += oss.str();
should be
mytime = oss.str();
…sigh… sorry for the noise…
No problem, have done this numerous times before. Glad u figured it out.