Hey everyone, just wanted to find out how everyone else would tackle this problem in the industry...
In my effort to convert my engine to newer OpenGl standards, I'm moving my text renderer from Immediate mode to using vertex buffers.
I've made a Text class which you create and pass a String to it's constructor along with other arguments... this object will generate a Vertex Array Object, and a Buffer Object and render the quads/triangles needed to draw the string of text into the buffer.
This works... until I need to change the text, like with a live FPS counter for example.
I have a setValue() function/method which lets me change the value of an existing Text object, by simply generating a new vertex array, and using glBufferData to swap it in the VAO. Problem is, it's losing all of the pointers to the vertex data, I have a feeling this is because glBufferData actually replaces the buffer altogether losing the pointers...
I've tried using glBufferSubData() but that still shows the same symptoms (Quads are drawn all over the game in random places and colours, totally nonsense).
Basically, can someone tell me whats the best way they know of rendering live text in OpenGL nowadays?