#ifndef _WIN32 #include "../winlnxdefs.h" #include #include #include #endif #include "glide.h" #include #include #ifdef _WIN32 #include #include #endif // _WIN32 #include "main.h" #ifdef _WIN32 #include "wglext.h" #endif // _WIN32 #ifndef WIN32 BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter); #endif extern int width, height; void do_benchmarks() { FILE * fp; int tw, th; fp = fopen("glide3x-benchmark.txt", "w"); if (!fp) goto error; glPushAttrib(GL_ALL_ATTRIB_BITS); // if (glUseProgramObjectARB) // glUseProgramObjectARB(0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glTranslatef(-1, -1, 0); glScalef(2, 2, 1); int npot, deltex, loop; for (npot=0; npot<3; npot++) for (deltex=0; deltex<2; deltex++) { int maxloop = 100; LARGE_INTEGER start; for (loop=0; loop0) glEnable(GL_TEXTURE_2D); else glDisable(GL_TEXTURE_2D); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glColor3f(1, 1, 0.5); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(0.05f, 0.05f); glTexCoord2f(1.0f*width/tw, 0.0f); glVertex2f(0.95f, 0.05f); glTexCoord2f(1.0f*width/tw, 1.0f*height/th); glVertex2f(0.95f, 0.95f); glTexCoord2f(0.0f, 1.0f*height/th); glVertex2f(0.05f, 0.95f); glTexCoord2f(0.0f, 0.0f); glVertex2f(0.05f, 0.05f); glEnd(); //grBufferSwap(0); } LARGE_INTEGER end; QueryPerformanceCounter(&end); fprintf(fp, "npot %d deltex %d : %gms\n", npot, deltex, (end.QuadPart-start.QuadPart)/1000.0f); } glPopMatrix(); glPopAttrib(); error: if (fp) fclose(fp); }