making test code identical on old and new renderer

This commit is contained in:
Brad Davis 2015-02-05 21:25:16 -08:00
parent 39794a7a40
commit 9b7743c6d3

View file

@ -100,6 +100,10 @@ public:
void draw();
};
#ifndef SERIF_FONT_FAMILY
#define SERIF_FONT_FAMILY "Times New Roman"
#endif
QTestWindow::QTestWindow() {
setSurfaceType(QSurface::OpenGLSurface);
@ -155,7 +159,8 @@ QTestWindow::QTestWindow() {
resizeGl();
}
static const wchar_t * EXAMPLE_TEXT = L"\xC1y Hello 1.0\ny\xC1 line 2\n\xC1y";
static const wchar_t * EXAMPLE_TEXT = L"Hello";
//static const wchar_t * EXAMPLE_TEXT = L"\xC1y Hello 1.0\ny\xC1 line 2\n\xC1y";
static const glm::uvec2 QUAD_OFFSET(10, 10);
static const glm::vec3 COLORS[4] = { { 1.0, 1.0, 1.0 }, { 0.5, 1.0, 0.5 }, {
@ -171,12 +176,8 @@ void QTestWindow::draw() {
+ QUAD_OFFSET.y }, { QUAD_OFFSET.x, size.y + QUAD_OFFSET.y }, };
QString str = QString::fromWCharArray(EXAMPLE_TEXT);
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < 4; ++i) {
glm::vec2 bounds = _textRenderer[i]->computeExtent(str);
// Draw backgrounds around where the text will appear
glPushMatrix();
{
glTranslatef(offsets[i].x, offsets[i].y, 0);
@ -191,13 +192,14 @@ void QTestWindow::draw() {
glEnd();
}
glPopMatrix();
const int testCount = 100;
for (int j = 0; j < testCount; ++j) {
// Draw backgrounds around where the text will appear
// Draw the text itself
_textRenderer[i]->draw(offsets[i].x, offsets[i].y, str,
_textRenderer[i]->draw(offsets[i].x, offsets[i].y, str.toLocal8Bit().constData(),
glm::vec4(COLORS[i], 1.0f));
}
}
_context->swapBuffers(this);
glFinish();
fps.increment();