But, not all is lost. See, while the performance is horrendous on Tung's demo, it's outstanding on other surface demos. See screenshot for an image of what's produced.
So, I was thinking Tung's demo is seriously flawed for HW acceleration. So I decided to make a different "thrash test" to see how robust my changes are. Turns out I get quite good results for "misusing" the surfaces like I do, below:
var surf = CreateSurface(48, 48, white);
surf.rectangle(12, 12, 24, 24, green);
surf.gradientRectangle(0, 0, 48, 48, green, green, white, white);
surf.line(0, 0, 48, 48, red);
surf.setPixel(8, 2, red);
surf.drawText(sys_font, 0, 0, "Hi");
while (!done) {
// draw surfaces:
for (var i = 0; i < 5; ++i) {
for (var j = 0; j < 5; ++j) {
surf.blit(0 + i * 48, 16 + j * 48);
}
}
// now, try to "thrash" the GPU (for Sphere GL/SSFML):
surf.rectangle(12, 12, 24, 24, green);
surf.gradientRectangle(0, 0, 48, 48, green, green, white, white);
surf.line(0, 0, 48, 48, red);
surf.setPixel(8, 2, red);
surf.drawText(sys_font, 0, 0, "Hi");
SSFML: 2700 fps
Sphere 1.5 GL: 1200 fps (pictured)
Sphere 1.5 32: 1700 fps
Sphere 1.6 32: 2100 fps
Sphere 1.6 really is a very fast Sphere version. But at least it shows my HW surfaces are really very fast. Tung's example is just bad for HW acceleration I guess, even though you will see better performance in other more cryptic methods of drawing textures. I will never arrest my case, his code is an anomaly, I am still shocked SphereGL's method is
any good, considering I still win in the above thrash test over Sphere-GL.