Commit 53f0a7be authored by vigmond's avatar vigmond
Browse files

Fixed flyby for mesalyzer

parent d1685f5a
Pipeline #3276 passed with stages
in 2 minutes and 2 seconds
...@@ -260,7 +260,7 @@ viewno = 0;} {} ...@@ -260,7 +260,7 @@ viewno = 0;} {}
} }
decl {int viewno;} {private local decl {int viewno;} {private local
} }
Function {fly( std::string fbase = std::string("") )} {open selected Function {fly( std::string fbase = std::string("") )} {open
} { } {
code {int start = fb_list->value(); code {int start = fb_list->value();
if( !start ) start = 1; if( !start ) start = 1;
...@@ -303,8 +303,8 @@ for( int i=start+1; i<=fb_list->size(); i++ ) { ...@@ -303,8 +303,8 @@ for( int i=start+1; i<=fb_list->size(); i++ ) {
return; return;
} }
} }
Frame frame( tbwm ); Frame frame( tbwm, tbwm->pixel_w(), tbwm->pixel_h() );
frame.write( tbwm->pixel_w(), tbwm->pixel_h(), framename, tbwm->time() ); frame.write( framename, tbwm->time() );
} else } else
usleep( fb_delay->value()*1000 ); usleep( fb_delay->value()*1000 );
} }
...@@ -316,9 +316,10 @@ Fl::flush(); ...@@ -316,9 +316,10 @@ Fl::flush();
if( fbase.size() ) { if( fbase.size() ) {
char framename[1024]; char framename[1024];
sprintf( framename, "%s%05d.png", fbase.c_str(), frameno++ ); sprintf( framename, "%s%05d.png", fbase.c_str(), frameno++ );
Frame frame( tbwm ); Frame frame( tbwm, tbwm->pixel_w(), tbwm->pixel_h() );
frame.write( tbwm->pixel_w(), tbwm->pixel_h(), framename, tbwm->time()); frame.write( framename, tbwm->time());
}} {} }} {selected
}
} }
Function {save( std::ostream &ostr )} {open Function {save( std::ostream &ostr )} {open
} { } {
......
...@@ -58,23 +58,7 @@ make_framebuffer( GLsizei w, GLsizei h, GLuint &fb, GLuint &cb, GLuint &db, bool ...@@ -58,23 +58,7 @@ make_framebuffer( GLsizei w, GLsizei h, GLuint &fb, GLuint &cb, GLuint &db, bool
} }
/** constructor to get OpenGL comntext */ /** General constructor */
Frame :: Frame( TBmeshWin *t ) : _tbwm(t)
{
#if !defined(OSMESA) && !defined(__APPLE__)
if( !initglew ) {
fl_open_display();
initglew = true;
glewExperimental = true;
GLenum err = glewInit();
if (GLEW_OK != err) {
std::cerr << "GLEW problem -- " << glewGetErrorString(err)<< " -- aborting!" << std::endl;
}
}
#endif
}
/** constructor to fill buffer with current screen contents */
Frame :: Frame( TBmeshWin *t, int w, int h, bool fa ) :_tbwm(t),_w(w),_h(h), Frame :: Frame( TBmeshWin *t, int w, int h, bool fa ) :_tbwm(t),_w(w),_h(h),
_full_alpha(fa), _buffer(new GLubyte[w*h*4]) _full_alpha(fa), _buffer(new GLubyte[w*h*4])
{ {
...@@ -101,13 +85,6 @@ Frame :: Frame( TBmeshWin *t, int w, int h, bool fa ) :_tbwm(t),_w(w),_h(h), ...@@ -101,13 +85,6 @@ Frame :: Frame( TBmeshWin *t, int w, int h, bool fa ) :_tbwm(t),_w(w),_h(h),
} }
/** constructor to dump to a file */
Frame :: Frame( TBmeshWin *t, int w, int h, std::string fname ) : _tbwm(t)
{
dump( w, h, fname );
}
Frame :: ~Frame() Frame :: ~Frame()
{ {
delete_objs(); delete_objs();
...@@ -125,7 +102,7 @@ Frame :: delete_objs() ...@@ -125,7 +102,7 @@ Frame :: delete_objs()
glDeleteRenderbuffers(1, &_color_rbms); glDeleteRenderbuffers(1, &_color_rbms);
glDeleteRenderbuffers(1, &_depth_rbms); glDeleteRenderbuffers(1, &_depth_rbms);
glDeleteFramebuffers(1, &_fbms); glDeleteFramebuffers(1, &_fbms);
#endif // OSMESA #endif
} }
...@@ -180,7 +157,7 @@ Frame :: write( int w, int h, std::string fname, int f0, int f1, int stride ) ...@@ -180,7 +157,7 @@ Frame :: write( int w, int h, std::string fname, int f0, int f1, int stride )
int int
Frame :: write( int w, int h, std::string fname, int f ) Frame :: write( int w, int h, std::string fname, int f )
{ {
if( !_tbwm->set_time(f) ) return 0; if( f>=0 && !_tbwm->set_time(f) ) return 0;
if( fname.length()<4 || (fname.substr(fname.length()-4)!=".png") ) if( fname.length()<4 || (fname.substr(fname.length()-4)!=".png") )
fname+= ".png"; fname+= ".png";
...@@ -190,7 +167,7 @@ Frame :: write( int w, int h, std::string fname, int f ) ...@@ -190,7 +167,7 @@ Frame :: write( int w, int h, std::string fname, int f )
} }
/* dump the frame buffer into a file /* dump the frame buffer into a PNG file
* *
* \param w * \param w
* \param h * \param h
......
...@@ -11,13 +11,14 @@ class TBmeshWin; ...@@ -11,13 +11,14 @@ class TBmeshWin;
class Frame { class Frame {
public: public:
Frame( TBmeshWin *t );
~Frame();
Frame( TBmeshWin *t, int, int, std::string );
Frame( TBmeshWin *t, int, int, bool=false ); Frame( TBmeshWin *t, int, int, bool=false );
int write( int, int, std::string, int ); ~Frame();
int write( int, int, std::string, int, int,int stride=1 ); int write( std::string s ){write(_w,_h,s);}
void dump( int, int, std::string ); int write( std::string s, int t){write(_w, _h, s, t);}
int write( int, int, std::string, int f=-1 );
int write( int, int, std::string, int, int,int stride=1 );
void dump( std::string s ){dump(_w,_h,s);}
void dump( int, int, std::string );
void pixel_color( int x, int y, GLubyte *color ){ void pixel_color( int x, int y, GLubyte *color ){
memcpy( color, _buffer+(x+_w*y)*4, 4*sizeof(GLubyte ) );} memcpy( color, _buffer+(x+_w*y)*4, 4*sizeof(GLubyte ) );}
private: private:
...@@ -27,9 +28,6 @@ class Frame { ...@@ -27,9 +28,6 @@ class Frame {
bool _full_alpha=false; bool _full_alpha=false;
TBmeshWin *_tbwm; TBmeshWin *_tbwm;
void delete_objs(); void delete_objs();
#ifdef OSMESA
OSMesaContext _ctx;
#endif
#ifdef USE_FBO #ifdef USE_FBO
GLuint _fb, _color_rb, _depth_rb; GLuint _fb, _color_rb, _depth_rb;
GLuint _fbms, _color_rbms, _depth_rbms; GLuint _fbms, _color_rbms, _depth_rbms;
......
...@@ -1442,7 +1442,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget ) ...@@ -1442,7 +1442,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget )
int update_period = 5; // number of frames after which to update progress int update_period = 5; // number of frames after which to update progress
int last_update=tm-update_period-10; int last_update=tm-update_period-10;
int frameskip=int(contwin->frameskip->value()); int frameskip=int(contwin->frameskip->value());
Frame frame( this ); Frame frame( this, pixel_w(), pixel_h() );
for ( ; tm<=stop; tm+=frameskip ) { for ( ; tm<=stop; tm+=frameskip ) {
if( model->pt.num_tm() ) model->pt.time(tm);//dynamic points if( model->pt.num_tm() ) model->pt.time(tm);//dynamic points
...@@ -1466,7 +1466,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget ) ...@@ -1466,7 +1466,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget )
if( Fl::pushed()==seqwidget->abortButton || seqwidget->abort() )break; if( Fl::pushed()==seqwidget->abortButton || seqwidget->abort() )break;
} }
sully(VBO_Time); sully(VBO_Time);
frame.dump( pixel_w(), pixel_h(), foutname ); frame.dump( foutname );
} }
if ( sequence ) { if ( sequence ) {
seqwidget->movieprog->label("100%"); seqwidget->movieprog->label("100%");
...@@ -1802,7 +1802,7 @@ void TBmeshWin::record_events( char* fn ) ...@@ -1802,7 +1802,7 @@ void TBmeshWin::record_events( char* fn )
unsigned long old_framenum=framenum; unsigned long old_framenum=framenum;
int num=0; int num=0;
Frame frame( this ); Frame frame( this, pixel_w(), pixel_h() );
while ( recording ) { while ( recording ) {
Fl::wait(); // process events one at a time Fl::wait(); // process events one at a time
if ( old_framenum != framenum ) { // see if the draw routine has been called if ( old_framenum != framenum ) { // see if the draw routine has been called
...@@ -1812,8 +1812,8 @@ void TBmeshWin::record_events( char* fn ) ...@@ -1812,8 +1812,8 @@ void TBmeshWin::record_events( char* fn )
if ( i0 < std::string::npos ) fname = fname.substr(0, i0); if ( i0 < std::string::npos ) fname = fname.substr(0, i0);
char fnum[32]; char fnum[32];
sprintf( fnum, "%05d", num++ ); sprintf( fnum, "%05d", num++ );
fname = fname + fnum + ".png"; fname += fnum;
frame.dump( w(), h(), fname ); frame.write( pixel_w(), pixel_h(), fname );
} }
} }
std::stringstream msg; std::stringstream msg;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment