Original Post
At the moment im just rendering out each letter via its only shader call, which is obviously not a good way of doing things, and am planning to optimize it. The code at the moment works by, 1. converting the data into a sting 2. loop throught each letter - calculate bitmap UV location - apply position, scaling, and ratio correction - send polgon to effect So im looking at making some sort of spritebatch that allows for a container to be filled up with data to be rendered, but renders it all in one go to be more optimized, or when it is manualy flushed. My plan is that when a letter is added to the spritebatch, i calculate the UV,scale, pos, and ratio correction into one matrix, along with the char, and then pop this into the container. And then when the spritebatch comes to render, i multiply the same polygon vertices by each of the spritbatch data members, so that rendering is done all in one go, with the sprite batch being rendered each frame, and the spritebatch then being renewed each frame, for when the letters chnage, or some affect is applied, but this is still going to be slow as each letter gets sent to the effect. And then theres the wasteage that the text is getting calculated each frame, when generally its only the UVs that are going to change. So im basically looking for way to create a descent optimzed bitmap font renderer
//add to batch call
///////////////////////////////
spritebatchObject t;
t.U = getU(char)
t.V = getV(char)
t.colour = col
t.transform = ( pos,scale,ratio corection etc etc)
spritebatch.pushback(t);
//render entire batch call
/////////////////////////////////
SendShader(BitmapImage);
start pass
for(i = 0, i < spritebatch.size(), ++i){
SendShader(spritebatch.transform);
SendShader( " ".colour;
.. etc etc
lockVbuffer squarePoly
//set verts UVs
unlockVbuffer squarePoly
dev->SetStreamSource(squarePoly);
}
end pass