From 095be9811eaccd92cee156b4c486fb92b77cdcd2 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 4 Apr 2011 00:01:39 +0200 Subject: Threaded VBO creation. A secondary memory-mapped VBO is filled in a separate thread, which replaces the main VBO when work is done. --- main.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 5f089e8..eee70dd 100644 --- a/main.cpp +++ b/main.cpp @@ -76,24 +76,14 @@ int main(int argc, char **argv) { bool gravity = true; SDL_WarpMouse(video::width/2, video::height/2); unsigned int last_time = SDL_GetTicks(); - unsigned int last_update = SDL_GetTicks(); - /*boost::timer t; - double last_time = 0;*/ Vector3 selected; Quadtree::QuadNode *node; Quadtree::QuadNode *last_node = NULL; scene.update(); while(running) { unsigned int time = SDL_GetTicks(); - //double time = t.elapsed(); - //t.restart(); unsigned int steps = time - last_time + 1; - //double steps = (time - last_time) * 1000; last_time = time; - /*if(time - last_update > 5000) { - scene.update(); - last_update = time; - }*/ bool do_select = 0; int sx, sy; while(SDL_PollEvent(&event)) { @@ -297,8 +287,8 @@ int main(int argc, char **argv) { float height = font->LineHeight(); glColor3f(1, 1, 1); glTranslatef(0, video::height-height, 0); - font->Render((boost::format("%dx%d %d levels %d nodes tree creation time: %f steps: %d") - % scene.qt->width % scene.qt->height % scene.qt->levels % scene.qt->nodes % scene.qt->init_time % steps).str().c_str()); + font->Render((boost::format("%dx%d %d levels %d nodes tree creation time: %f steps: %d update: %d") + % scene.qt->width % scene.qt->height % scene.qt->levels % scene.qt->nodes % scene.qt->init_time % steps % scene.qt->thread_running).str().c_str()); //glTranslatef(0, height, 0); //font->Render((boost::format("selected: %x") % selected).str().c_str()); glTranslatef(0, -height, 0); -- cgit v1.2.3