Clipping text


Using glViewport() before the text render, to limit the size of the drawing area to fit the blue box, had no effect. How can I clip the text to fit inside the label area?

I thought for sure that using a clipping plane would fix things, but look! It only clips entire text, and doesn’t do a thing for overhanging text that begins on the non-clipping side of the plane:

Try glEnable(GL_SCISSOR_TEST) and glScissor(x,y,w,h) (screen coordinates!) with each blue box’s content.
Or if screen coordinates are too difficult, request a pixelformat with stencil buffer, the blue boxes fill the stencil and the font drawing tests against it.