examples/eqNBody/window.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "window.h"
00019
00020 #include "pipe.h"
00021 #include "config.h"
00022 #include "configEvent.h"
00023 #include "frameData.h"
00024
00025 #include <fstream>
00026 #include <sstream>
00027
00028 using namespace std;
00029
00030 namespace eqNbody
00031 {
00032 bool Window::configInit( const uint32_t initID )
00033 {
00034
00035 const string& name = getName();
00036 size_t sepos = name.find(":");
00037
00038 EQASSERT(sepos != string::npos);
00039
00040 std::string tname = name.substr(0,sepos);
00041
00042 if(tname == "CUDA") {
00043 _mode = WINDOW_CUDA;
00044 }
00045 else if(tname == "CUDA_GL") {
00046 _mode = WINDOW_CUDA_GL;
00047 }
00048 else {
00049 EQWARN << "Unhandled Window type '" << tname << "'" << std::endl;
00050 return false;
00051 }
00052
00053
00054 Pipe* pipe = static_cast<Pipe*>(getPipe());
00055 _device = pipe->getDevice();
00056
00057 if( !eq::Window::configInit( initID )) {
00058 return false;
00059 }
00060
00061 return true;
00062 }
00063
00064 void Window::swapBuffers()
00065 {
00066 const Pipe* pipe = static_cast<Pipe*>( getPipe( ));
00067 const FrameData& frameData = pipe->getFrameData();
00068 const eq::ChannelVector& channels = getChannels();
00069
00070 if( frameData.useStatistics() && !channels.empty( ))
00071 EQ_GL_CALL( channels.back()->drawStatistics( ));
00072
00073 eq::Window::swapBuffers();
00074 }
00075 }