-enum ProfilerState { statePreRender, stateClear, stateDraw, statePresent, statePostRender, stateOutsideRender, numProfilerStates };
-static const char *profilerStateNames[numProfilerStates] = { "Pre-Render", "Clearing", "Drawing", "Presenting", "Post-Render", "Outside renderer"};
+enum ProfilerState { StatePreRender, StateClear, StateDraw, StatePresent, StatePostRender, StateOutsideRender, NumProfilerStates };
+static const char *profilerStateNames[NumProfilerStates] = { "Pre-Render", "Clearing", "Drawing", "Presenting", "Post-Render", "Outside renderer"};
-static void rectVertices(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+static void rectQuad(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
lastDisplay = lastProfile = getTime();
}
virtual void resizeGL(unsigned int width, unsigned int height)
{
lastDisplay = lastProfile = getTime();
}
virtual void resizeGL(unsigned int width, unsigned int height)
{
glViewport(0, 0, width, height);
glViewport(0, 0, width, height);
glOrtho (0, 1, 1, 0, 0, 1);
glOrtho (0, 1, 1, 0, 0, 1);
- glMatrixMode(GL_MODELVIEW);
- glClear(GL_COLOR_BUFFER_BIT);
+ glMatrixMode(GL_MODELVIEW);
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
const double elapsed = time-lastDisplay;
if (elapsed >= 3) {
printf("%.1f fps, time spent: ", framect/elapsed);
const double elapsed = time-lastDisplay;
if (elapsed >= 3) {
printf("%.1f fps, time spent: ", framect/elapsed);
if (i != 0) printf(", ");
printf("%s %.1f%%", profilerStateNames[i], stateTime[i]/elapsed*100);
}
if (i != 0) printf(", ");
printf("%s %.1f%%", profilerStateNames[i], stateTime[i]/elapsed*100);
}
- rectVertices(boxPos, 0, boxPos+boxWidth, 1);
+ rectQuad(boxPos, 0, boxPos+boxWidth, 1);
if (copy) {
glDrawBuffer(GL_FRONT);
glCopyPixels(0, 0, getWidth(), getHeight(), GL_COLOR);
if (copy) {
glDrawBuffer(GL_FRONT);
glCopyPixels(0, 0, getWidth(), getHeight(), GL_COLOR);
GLfloat boxPos, boxDirection;
// FPS, profiler
double lastDisplay, lastProfile;
GLfloat boxPos, boxDirection;
// FPS, profiler
double lastDisplay, lastProfile;