本文整理汇总了C++中Viewer::Thaw方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::Thaw方法的具体用法?C++ Viewer::Thaw怎么用?C++ Viewer::Thaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::Thaw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnToolMovie
/**
* @function OnToolMovie
* @brief
* @date 2011-10-13
*/
void GRIPFrame::OnToolMovie(wxCommandEvent& event){
wxString dirname = wxDirSelector(wxT("Choose output directory for movie pictures:")); // , "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST
if ( dirname.empty() ){ // filename
std::cout << "No Directory Selected" << std::endl;
return;
}
string path = string(dirname.mb_str());
char *buf = new char[1000];
//Create a new Viewer Window
wxFrame *movieFrame = new wxFrame(NULL,wxID_ANY, wxT("MovieWindow"),wxPoint(0, 0), wxSize(renderW,renderH),wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxMAXIMIZE_BOX));
//#ifndef WIN32 // Weird hack to make wxWidgets work in Linux
movieFrame->Show();
//#endif
int attrib[] = {WX_GL_DOUBLEBUFFER,WX_GL_RGBA, WX_GL_DEPTH_SIZE, 16,0};
Viewer *movieViewer = new Viewer(movieFrame, viewer, wxID_ANY, wxPoint(0, 0), wxSize(renderW, renderH), 0, _T("MovieWindow"), attrib);
movieViewer->backColor = viewer->backColor;
movieViewer->gridColor = viewer->gridColor;
//movieFrame.AddChild(
#ifdef WIN32 // Weird hack to make wxWidgets work with VC++ debug
movieViewer->MSWSetOldWndProc((WXFARPROC)DefWindowProc);
#endif
int w,h;
movieViewer->Show(true);
movieViewer->Freeze();
wxClientDC dc2(movieViewer);
dc2.GetSize(&w, &h);
movieViewer->InitGL();
movieViewer->Thaw();
movieViewer->handleEvents = false;
movieViewer->Show(true);
movieViewer->camT = viewer->camT;
movieViewer->camRotT = viewer->camRotT;
movieViewer->camRadius = viewer->camRadius;
movieViewer->worldV = viewer->worldV;
double curTargetTime = 0.0;
std::vector<GRIPTimeSlice>::iterator it = timeVector.begin();
int framesWritten = 0;
double framerate = 30.0;
do {
if (it == timeVector.end()) break; // call it done
while((*it).time < curTargetTime) it++;
// Issue 122 from DART
//mWorld->setState((*it).state);
Eigen::VectorXd newState = (*it).state;
setState_Issue122( newState );
movieViewer->DrawGLScene();
wxYield();
unsigned char* imageData = (unsigned char*) malloc(w * h * 3);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, imageData);
wxImage img_ud(w,h,imageData);
wxImage img = img_ud.Mirror(false);
sprintf(buf, "%s/%06d.png",path.c_str(), framesWritten);
wxString fname = wxString(buf,wxConvUTF8);
cout << "Saving frame at t = " << (*it).time << " (targeting " << curTargetTime << ") into " << buf << "" << endl;
img.SaveFile(fname, wxBITMAP_TYPE_PNG);
framesWritten++;
curTargetTime += 1.0 / framerate;
} while (curTargetTime < timeVector.back().time);
delete movieViewer;
delete movieFrame;
viewer->InitGL();
delete buf;
event.Skip();
}