Exemplo n.º 1
0
void Playback3D::write_buffer_sync(Playback3DCommand *command)
{
	command->canvas->lock_canvas("Playback3D::write_buffer_sync");
	if(command->canvas->get_canvas())
	{
		BC_WindowBase *window = command->canvas->get_canvas();
		window->lock_window("Playback3D::write_buffer_sync");
// Update hidden cursor
		window->update_video_cursor();
// Make sure OpenGL is enabled first.
		window->enable_opengl();


//printf("Playback3D::write_buffer_sync 1 %d\n", window->get_id());
		switch(command->frame->get_opengl_state())
		{
// Upload texture and composite to screen
			case VFrame::RAM:
				command->frame->to_texture();
				draw_output(command);
				break;
// Composite texture to screen and swap buffer
			case VFrame::TEXTURE:
				draw_output(command);
				break;
			case VFrame::SCREEN:
// swap buffers only
				window->flip_opengl();
				break;
			default:
				printf("Playback3D::write_buffer_sync unknown state\n");
				break;
		}
		window->unlock_window();
	}

	command->canvas->unlock_canvas();
}
Exemplo n.º 2
0
void Simulation::tick()
{
   glViewport(0, 0, viewportWidth, viewportHeight);

   if(!filledTargetBuffer)
   {
      fill_target_buffer();
   }
    
   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
   {
      mutate_triangles();
      draw_triangles();
      compare_fitness();
   }
   glBindFramebuffer(GL_FRAMEBUFFER, originalFbo);
         
   draw_output();
}