diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -20,11 +20,11 @@ void resize(int width, int height); void initGL(bool multisample) { glClearColor(1.0, 0.85, 0.06, 1.0); glClearDepth(1.0); - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); + //glEnable(GL_DEPTH_TEST); + //glDepthFunc(GL_LEQUAL); - //glEnable(GL_BLEND); - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); #ifndef _WIN32 if(multisample) @@ -34,14 +34,14 @@ void initGL(bool multisample) { resize(DEFAULT_WIDTH, DEFAULT_HEIGHT); glEnable(GL_LIGHTING); - static const float light[] = {-1, -1, -1, 0}; + static const float light[] = {1, 1, 1, 0}; static const float lightColor[] = {1, 1, 1, 1}; glLightfv(GL_LIGHT0, GL_POSITION, light); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); glEnable(GL_LIGHT0); - glEnable(GL_CULL_FACE); - glFrontFace(GL_CCW); + //glEnable(GL_CULL_FACE); + //glFrontFace(GL_CCW); } void resize(int width, int height) @@ -382,11 +382,13 @@ int main() { glXSwapBuffers(disp, wnd); XSync(disp, 0); + long slept = 0; gettimeofday(&tv, NULL); delta = ((tv.tv_usec + 1000000 - ticks)%1000000)/1000; if(delta < MIN_FRAME_DELTA) { usleep((MIN_FRAME_DELTA-delta)*1000); + slept += (MIN_FRAME_DELTA-delta); gettimeofday(&tv, NULL); delta = ((tv.tv_usec + 1000000 - ticks)%1000000)/1000; @@ -397,9 +399,10 @@ int main() { frames++; tocks += delta*1000; if(tocks > 1000000) { - std::cerr << frames << std::endl; + std::cerr << frames << " fps; slept a total of " << slept << " ms" << std::endl; frames = 0; tocks -= 1000000; + slept = 0; } } |