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;} {}
}
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();
if( !start ) start = 1;
......@@ -303,8 +303,8 @@ for( int i=start+1; i<=fb_list->size(); i++ ) {
return;
}
}
Frame frame( tbwm );
frame.write( tbwm->pixel_w(), tbwm->pixel_h(), framename, tbwm->time() );
Frame frame( tbwm, tbwm->pixel_w(), tbwm->pixel_h() );
frame.write( framename, tbwm->time() );
} else
usleep( fb_delay->value()*1000 );
}
......@@ -316,9 +316,10 @@ Fl::flush();
if( fbase.size() ) {
char framename[1024];
sprintf( framename, "%s%05d.png", fbase.c_str(), frameno++ );
Frame frame( tbwm );
frame.write( tbwm->pixel_w(), tbwm->pixel_h(), framename, tbwm->time());
}} {}
Frame frame( tbwm, tbwm->pixel_w(), tbwm->pixel_h() );
frame.write( framename, tbwm->time());
}} {selected
}
}
Function {save( std::ostream &ostr )} {open
} {
......
......@@ -58,23 +58,7 @@ make_framebuffer( GLsizei w, GLsizei h, GLuint &fb, GLuint &cb, GLuint &db, bool
}
/** constructor to get OpenGL comntext */
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 */
/** General constructor */
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])
{
......@@ -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()
{
delete_objs();
......@@ -125,7 +102,7 @@ Frame :: delete_objs()
glDeleteRenderbuffers(1, &_color_rbms);
glDeleteRenderbuffers(1, &_depth_rbms);
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 )
int
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") )
fname+= ".png";
......@@ -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 h
......
......@@ -11,12 +11,13 @@ class TBmeshWin;
class Frame {
public:
Frame( TBmeshWin *t );
~Frame();
Frame( TBmeshWin *t, int, int, std::string );
Frame( TBmeshWin *t, int, int, bool=false );
int write( int, int, std::string, int );
~Frame();
int write( std::string s ){write(_w,_h,s);}
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 ){
memcpy( color, _buffer+(x+_w*y)*4, 4*sizeof(GLubyte ) );}
......@@ -27,9 +28,6 @@ class Frame {
bool _full_alpha=false;
TBmeshWin *_tbwm;
void delete_objs();
#ifdef OSMESA
OSMesaContext _ctx;
#endif
#ifdef USE_FBO
GLuint _fb, _color_rb, _depth_rb;
GLuint _fbms, _color_rbms, _depth_rbms;
......
......@@ -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 last_update=tm-update_period-10;
int frameskip=int(contwin->frameskip->value());
Frame frame( this );
Frame frame( this, pixel_w(), pixel_h() );
for ( ; tm<=stop; tm+=frameskip ) {
if( model->pt.num_tm() ) model->pt.time(tm);//dynamic points
......@@ -1466,7 +1466,7 @@ void TBmeshWin::output_png( const char* fn, Sequence *seqwidget )
if( Fl::pushed()==seqwidget->abortButton || seqwidget->abort() )break;
}
sully(VBO_Time);
frame.dump( pixel_w(), pixel_h(), foutname );
frame.dump( foutname );
}
if ( sequence ) {
seqwidget->movieprog->label("100%");
......@@ -1802,7 +1802,7 @@ void TBmeshWin::record_events( char* fn )
unsigned long old_framenum=framenum;
int num=0;
Frame frame( this );
Frame frame( this, pixel_w(), pixel_h() );
while ( recording ) {
Fl::wait(); // process events one at a time
if ( old_framenum != framenum ) { // see if the draw routine has been called
......@@ -1812,8 +1812,8 @@ void TBmeshWin::record_events( char* fn )
if ( i0 < std::string::npos ) fname = fname.substr(0, i0);
char fnum[32];
sprintf( fnum, "%05d", num++ );
fname = fname + fnum + ".png";
frame.dump( w(), h(), fname );
fname += fnum;
frame.write( pixel_w(), pixel_h(), fname );
}
}
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