I'm using FTGL library to render text in my C++ project.
I can easily render text by using:
CFontManager::Instance().renderWrappedText(font, lineLength, position, text);
Unfortunately there is a situation in which this Button which displays text, is partly hidden because of resizing container in which it is situated. I'm able without any problem to draw Button's background to fit the container, but I've got a problem with doing the same with a text. Is it possible to somehow draw only text for given width and the rest just ignore?
This is a screen which presents my problem:
As you can see, the Button "Click here" is being drawn properly, but I can't do the same with "Click here" text.
You may try using glScissor
like this:
glEnable(GL_SCISSOR_TEST);
glScissor(windowPosition.x, windowPosition.y, windowWidth, windowHeight);
// here put your draw method of your window and objects inside it
glDisable(GL_SCISSOR_TEST);
More info : http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml