Hi,
I am using the cool text library by @paul.houx for rendering text (https://github.com/paulhoux/Cinder-Samples/tree/master/TextRendering) on a 3D rectangular plane (camera can zoom pan tilt etc), and the signed distance field method works very well independent of camera zoom.
The problem i’m having is that I am not sure how to go about “clipping” the text, so that if the string would render larger than a specific size specified in world coords, then the part outside the limits won’t display, leaving the part inside on display.
I’ve tried using:
gl::pushMatrices();
Rectf textBounds = mTextBox.getBounds();
gl::translate(vec2(mCurrentPosition.value().x, mCurrentPosition.value().y));
gl::rotate(glm::radians(mCurrentRotation), 0, 0, 1);
gl::scale(vec2(2, 2));
mTextBox.setSize(getWidth(), getHeight());
mTextBox.setText("Text String");
gl::ScopedScissor sC(textBounds.getUpperLeft(), textBounds.getSize());
mTextBox.draw();
gl::popMatrices();
The above code does not work correctly, but I’m not sure if its a Cinder question or a question related to Paul’s library. I haven’t really delved into this area before and was wondering if someone else has came across the same problem?
Cheers