PDA

View Full Version : Drawing text using vector font in one draw call.



YarUnderoaker
01-24-2011, 12:02 PM
I have a vector font geometry via array and element buffers, text and position offset for each of its symbol. I want draw it by MultiDrawElements, but can't decide how to do that.

At first need to collect list of ranges of elements, then pass offset positions to shader as uniform's array. But in shader we don't know what symbol is currently drawing and can't calculate index for uniform array.
Unfortunately MultiDrawElements does not provide value of drawing batch.
Instancing can't be useful too because each instance has equal number of primitives when each symbol has different number of primitives.

I see only one solution - drawing by DrawElements and pass position offset (may be color additional) as vertex attribute symbol by symbol.

Any suggestion of respected community.