本文整理汇总了C++中FrameSaver类的典型用法代码示例。如果您正苦于以下问题:C++ FrameSaver类的具体用法?C++ FrameSaver怎么用?C++ FrameSaver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrameSaver类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myKey
/*******************************************************************************
Function that gets called for any keypresses.
*******************************************************************************/
void myKey(unsigned char key, int x, int y)
{
float time;
const double speed = 1.0;
switch (key)
{
case 'q':
case 27:
exit(0);
case 's':
g_frameSaver.DumpPPM(g_width,g_height);
break;
case 'x':
addRandomFoodParticle( 100, &World, &Space );
animator.scanForFood( animator.foodParticles.back() );
break;
case 'r':
resetArcball();
break;
case '1':
animator.active = !animator.active;
break;
case 'a':
g_animate = 1 - g_animate;
//Reset the timer to point to the current time.
time = g_timer.GetElapsedTime();
g_timer.Reset();
break;
case '0':
//Reset your object.
break ;
case 'm':
if( g_recording == 1 )
{
std::cout << "Frame recording disabled." << std::endl;
g_recording = 0;
}
else
{
std::cout << "Frame recording enabled." << std::endl;
g_recording = 1 ;
}
g_frameSaver.Toggle();
break ;
case 'h':
case '?':
GDrawing::plotInstructions();
break;
}
glutPostRedisplay();
}
示例2: display
/*********************************************************
**********************************************************
**********************************************************
PROC: display()
DOES: this gets called by the event handler to draw
the scene, so this is where you need to build
your ROBOT --
MAKE YOUR CHANGES AND ADDITIONS HERE
Add other procedures if you like.
**********************************************************
**********************************************************
**********************************************************/
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
model_view = mat4(1.0f);
model_view *= Translate(0.0f, -5.0f, -15.0f);
HMatrix r;
Ball_Value(Arcball,r);
mat4 mat_arcball_rot(
r[0][0], r[0][1], r[0][2], r[0][3],
r[1][0], r[1][1], r[1][2], r[1][3],
r[2][0], r[2][1], r[2][2], r[2][3],
r[3][0], r[3][1], r[3][2], r[3][3]);
model_view *= mat_arcball_rot;
glUniformMatrix4fv( uView, 1, GL_TRUE, model_view );
// Previously glScalef(Zoom, Zoom, Zoom);
model_view *= Scale(Zoom);
//draw objects
drawGround();
drawBee();
drawFlower();
glutSwapBuffers();
if(Recording == 1)
FrSaver.DumpPPM(Width, Height);
}
示例3: myKey
void myKey(unsigned char key, int x, int y)
{
float time ;
switch (key) {
case 'q':
case 27:
exit(0);
case 's':
FrSaver.DumpPPM(Width,Height) ;
break;
case 'r':
resetArcball() ;
glutPostRedisplay() ;
break ;
case 'a': // togle animation
Animate = 1 - Animate ;
// reset the timer to point to the current time
time = TM.GetElapsedTime() ;
TM.Reset() ;
// printf("Elapsed time %f\n", time) ;
break ;
case '0':
//reset your object
break ;
case 'm':
if( Recording == 1 )
{
printf("Frame recording disabled.\n") ;
Recording = 0 ;
}
else
{
printf("Frame recording enabled.\n") ;
Recording = 1 ;
}
FrSaver.Toggle(Width);
break ;
case 'h':
case '?':
instructions();
break;
}
glutPostRedisplay() ;
}
示例4: display
/*********************************************************
**********************************************************
**********************************************************
PROC: display()
DOES: this gets called by the event handler to draw
the scene, so this is where you need to build
your ROBOT --
MAKE YOUR CHANGES AND ADDITIONS HERE
Add other procedures if you like.
**********************************************************
**********************************************************
**********************************************************/
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
model_view = mat4(1.0f);
model_view *= Translate(0.0f, 0.0f, -15.0f);
HMatrix r;
Ball_Value(Arcball,r);
mat4 mat_arcball_rot(
r[0][0], r[0][1], r[0][2], r[0][3],
r[1][0], r[1][1], r[1][2], r[1][3],
r[2][0], r[2][1], r[2][2], r[2][3],
r[3][0], r[3][1], r[3][2], r[3][3]);
model_view *= mat_arcball_rot;
mat4 view = model_view;
//model_view = Angel::LookAt(eye, ref, up);//just the view matrix;
glUniformMatrix4fv( uView, 1, GL_TRUE, model_view );
// Previously glScalef(Zoom, Zoom, Zoom);
model_view *= Scale(Zoom);
// Draw Something
set_colour(0.8f, 0.8f, 0.8f);
drawSphere();
// Previously glTranslatef(3,0,0);
model_view *= Translate(3.0f, 0.0f, 0.0f);
// Previously glScalef(3,3,3);
model_view *= Scale(3.0f, 3.0f, 3.0f);
drawCube();
// And extra shapes!
model_view *= Scale(1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f);
model_view *= Translate(3.0f, 0.0f, 0.0f);
set_colour(1.0f, 1.0f, 0.0f);
drawCone();
model_view *= Translate(-9.0f, 0.0f, 0.0f);
set_colour(1.0f, 1.0f, 1.0f);
drawCylinder();
glutSwapBuffers();
if(Recording == 1)
FrSaver.DumpPPM(Width, Height) ;
}
示例5: display
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
model_view = mat4(1.0f);
model_view *= Translate(-1.0f, 0.0f, -10.0f);
model_view *= Translate(-cameraX,-cameraY,-cameraZ);
glUniformMatrix4fv( uView, 1, GL_TRUE, model_view );
drawCube();
model_view *= Translate(2.0f, 0.0f, 0.0f);
drawCrate();
glutSwapBuffers();
if(Recording == 1)
FrSaver.DumpPPM(Width, Height) ;
}
示例6: display
/*********************************************************
**********************************************************
**********************************************************
PROC: display()
DOES: this gets called by the event handler to draw
the scene, so this is where you need to build
your ROBOT --
MAKE YOUR CHANGES AND ADDITIONS HERE
Add other procedures if you like.
**********************************************************
**********************************************************
**********************************************************/
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mat4 model_trans(1.0f);
mat4 view_trans(1.0f);
view_trans *= Translate(0.0f, 0.0f, -15.0f);
HMatrix r;
Ball_Value(Arcball, r);
mat4 mat_arcball_rot(
r[0][0], r[0][1], r[0][2], r[0][3],
r[1][0], r[1][1], r[1][2], r[1][3],
r[2][0], r[2][1], r[2][2], r[2][3],
r[3][0], r[3][1], r[3][2], r[3][3]);
view_trans *= mat_arcball_rot;
view_trans *= Scale(Zoom);
glUniformMatrix4fv(uView, 1, GL_TRUE, model_view);
model_view = view_trans;
mvstack.push(model_view);
drawGround(view_trans);
model_view = mvstack.top();
mvstack.pop();
model_view *= Translate(0, -10, 0);
drawFlower();
drawBee();
glutSwapBuffers();
if (Recording == 1)
FrSaver.DumpPPM(Width, Height);
}
示例7: display
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
model_view = mat4(1.0f);
double curprev = TM.GetElapsedTime() - prev;
frames++;
if (curprev > 1)
{
prev = TM.GetElapsedTime();
fps = frames / curprev;
frames = 0;
printf("FPS: %i\n", fps);
}
model_view *= Translate(0.0f, 0.0f, -15.0f);
HMatrix r;
Ball_Value(Arcball,r);
mat4 mat_arcball_rot(
r[0][0], r[0][1], r[0][2], r[0][3],
r[1][0], r[1][1], r[1][2], r[1][3],
r[2][0], r[2][1], r[2][2], r[2][3],
r[3][0], r[3][1], r[3][2], r[3][3]);
model_view *= mat_arcball_rot;
mat4 view = model_view;
// model_view = Angel::LookAt(eye, ref, up);//just the view matrix;
glUniformMatrix4fv( uView, 1, GL_TRUE, model_view );
// Previously glScalef(Zoom, Zoom, Zoom);
model_view *= Scale(Zoom);
// Draw Something
mvstack.push(model_view);
drawWorld();
model_view = mvstack.pop();
//guy 1
mvstack.push(model_view);
model_view *= Translate (0, 8, -40);
model_view *= Scale(1.5, 1.5, 1.5);
model_view *= RotateY(180);
// turn
if (TIME >= 5 && TIME < 6)
{
model_view *= RotateY(-900 + TIME*180);
}
// move up
else if (TIME >= 6 && TIME < 6.5)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0 , -36 + TIME*6);
}
// jump on bench
else if (TIME >= 6.5 && TIME < 7)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0, 3);
model_view *= Translate (0, -16.25 + TIME*2.5, -13 + TIME*2);
}
// jump off bench
else if (TIME >= 7 && TIME < 7.5)
{
model_view *= RotateY(180);
model_view *= Translate(0, 1.25, 4);
model_view *= Translate(0, -112 + TIME*16, -112 + TIME*16);
model_view *= RotateX(-5040 + TIME*720);
}
// land
else if (TIME >= 7.5 && TIME < 8)
{
model_view *= RotateY(180);
model_view *= Translate(0, 9.25, 15);
model_view *= Translate (0, 138.75-TIME*18.5, 0);
}
// walk toward other guy
else if (TIME >= 8 && TIME < 9)
{
model_view *= RotateY(180);
model_view *= Translate(0, 0, 15);
model_view *= Translate(0, 0, -64 + TIME*8);
}
// stand for a bit
else if (TIME >= 9 && TIME < 15)
{
model_view *= RotateY(180);
model_view *= Translate(0, 0, 23);
model_view *= RotateY(3*sin(5*TIME));
}
// spin thing
else if (TIME >= 15 && TIME < 16)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0, 23);
//.........这里部分代码省略.........
示例8: display
void display(void)
{
static double oldTime = GlobalResourceManager::use()->getActualTime();
oldTime = g_globalTimer.GetElapsedTime() ;
glClearColor(0.2f,0.2f,1.0f,0.5f); /* set the background colour */
/* OK, now clear the screen with the background colour */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity();
g_eye[Z] = 8 ;
gluLookAt (g_eye[X], g_eye[Y], g_eye[Z],
g_ref[X], g_ref[Y], g_ref[Z], 0.0,1.0,0.0);
HMatrix arcball_rot;
Ball_Value(g_arcball,arcball_rot);
glMultMatrixf((float *)arcball_rot);
glScalef(g_zoom, g_zoom, g_zoom) ;
DrawScene() ;
glMatrixMode(GL_PROJECTION) ;
glPushMatrix() ;
glLoadIdentity();
glMatrixMode(GL_MODELVIEW) ;
glPushMatrix() ;
glLoadIdentity();
// display frame rate
glPushAttrib(GL_LIGHTING|GL_TEXTURE_2D) ;
glDisable(GL_LIGHTING) ;
glDisable(GL_TEXTURE_2D) ;
glColor3f(1,1,1) ;
// int fps = (int) ((float) 1.0) / (TIME - oldTime) ;
int fps = (int) ((float) 1.0) / (g_globalTimer.GetElapsedTime() - oldTime) ;
oldTime = GlobalResourceManager::use()->getActualTime() ;
char s[80] ;
sprintf(s,"FPS: %5d TIME %6.3lf SIMTIME %6.3lf%c",
fps,GlobalResourceManager::use()->getActualTime(),
GlobalResourceManager::use()->getSimulationTime(),'\0') ;
glRasterPos2f(-0.98,-0.98) ;
GLlabel(s, 15) ;
glPopAttrib() ;
glMatrixMode(GL_PROJECTION) ;
glPopMatrix() ;
glMatrixMode(GL_MODELVIEW) ;
glPopMatrix() ;
glutSwapBuffers();
if( g_frameDumping == 1) g_frameSaver.DumpPPM(g_width,g_height) ;
}
示例9: KeyboardCB
void KeyboardCB(unsigned char key, int x, int y)
{
switch (key) {
case 'q':
case 27:
exit(0);
case 'f': // take a snapshot in ppm format
g_frameSaver.DumpPPM(g_width,g_height) ;
break;
case 't':
resetTime() ;
break ;
case 'r':
resetArcball() ;
Reset() ;
g_zoom = 1 ;
glutPostRedisplay() ;
break ;
case 'a': // toggle animation state
if( g_state == STATE_ANIMATE )
{
g_state = STATE_IDLE ;
}
else
{
resetTime() ;
g_state = STATE_ANIMATE ;
}
break ;
case 's': // togle simulation state
if( g_state == STATE_SIMULATE )
{
g_state = STATE_IDLE ;
}
else
{
resetTime() ;
InitSimulation() ;
g_state = STATE_SIMULATE ;
}
break ;
case 'p': // togle playback
if( g_state == STATE_PLAYBACK )
{
g_state = STATE_IDLE ;
}
else
{
g_state = STATE_PLAYBACK ;
}
break ;
case '0':
//reset your object
break ;
case 'm': // toggle frame dumping
if( g_frameDumping == 1 )
{
animTcl::OutputMessage("Frame Frame Dumping disabled.\n") ;
g_frameDumping = 0 ;
}
else
{
animTcl::OutputMessage("Frame Frame Dumping enabled.\n") ;
g_frameDumping = 1 ;
}
g_frameSaver.Toggle(g_width);
break ;
case 'h':
case '?':
instructions();
break;
}
myKey(key, x, y) ;
glutPostRedisplay() ;
}
示例10: display
void display(void)
{
// Clear the screen with the background colour (set in myinit)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
model_view = mat4(1.0f);
model_view *= Translate(0.0f, 0.0f, -15.0f);
HMatrix r;
Ball_Value(Arcball,r);
mat4 mat_arcball_rot(
r[0][0], r[0][1], r[0][2], r[0][3],
r[1][0], r[1][1], r[1][2], r[1][3],
r[2][0], r[2][1], r[2][2], r[2][3],
r[3][0], r[3][1], r[3][2], r[3][3]);
model_view *= mat_arcball_rot;
mat4 view = model_view;
glUniformMatrix4fv( uView, 1, GL_TRUE, view );
// Previously glScalef(Zoom, Zoom, Zoom);
model_view *= Scale(Zoom);
model_view *= Translate(0.0f, 0.0f, -10.0f);
model_view *= RotateX(10);
//if(prologue < 20) {
// model_view *= Translate(0.0f, -20.0f+prologue, 0.0f);
// cam_eye = vec4(rotateX, 0.0, rotateZ, 1.0);
// model_view *= LookAt(cam_eye, cam_ref, cam_up);
//}
//if(timeline > 57)
// model_view *= Translate(0.0f, -temp3, -0.0f);
// Draw Scene
drawScene();
// Draw Leaf
if(timeline < 8.0f) {
mvstack.push(model_view);
model_view *= Translate(0.0f, 25.0f-prologue, 0.0f);
model_view *= RotateZ(leafSway);
model_view *= Translate(4.0f, -1.0f-prologue, 3.0f);
drawLeaf();
model_view = mvstack.pop();
}
/*/ // Draw Bee
if(timeline > 35.0f && timeline < 38.0f) {
mvstack.push(model_view);
model_view *= Translate(15.0f-(temp2-230), pathBeeVert, 4.5f);
model_view *= Scale(0.5f, 0.5f, 0.5f);
drawBee();
model_view = mvstack.pop();
}
/*/
//draw GFS
mvstack.push(model_view);
if(timeline>28&&timeline<36)
{
model_view *= Translate(47.5f-temp5/2, 0.0f, 3.0f);
model_view*=RotateY(-90);
record=40.0f-temp5/2;
}
else if(timeline>=36&&timeline<=40)
{
model_view *= Translate(7.5f, 0.0f, 4.0);
model_view*=RotateY(-135);
}
else if(timeline>40&&timeline<59)
{
model_view *= Translate(7.5f+temp6/4, 0.0f, 2.0f);
model_view *= RotateY(90);
}
if(timeline>=28)
drawGFS(1,1,1);
model_view = mvstack.pop();
// Draw Male
mvstack.push(model_view);
if(timeline > 20.0f && timeline < 24.0f) {
model_view *= Translate(-5.0f+temp, 0.0f, 2.25f);
prevX = -5.0+temp;
}
else if(timeline >= 24.0f && timeline < 27.0f)
model_view *= Translate(prevX-temp, 0.0f, 2.25f);
else if(timeline > 30.5 && timeline < 36.0) {
model_view *= Translate(-25.0+temp2/10, -.75f, 4.5f);
prevX = -25.0+temp2/10;
model_view *= RotateY(90);
}
else if(timeline >= 35.0f && timeline < 55.0) {
model_view *= Translate(prevX, -.75f, 4.5f);
model_view *= RotateY(135);
}
//.........这里部分代码省略.........
示例11: display
/*******************************************************************************
Function that gets called by the event handler to draw the scene.
*******************************************************************************/
void display(void)
{
//glClearColor (red, green, blue, alpha)
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); //Set the background color.
//OK, now clear the screen with the background color.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Load initial matrix transformation.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//Locate the camera.
gluLookAt (g_eye[X], g_eye[Y], g_eye[Z], g_ref[X], g_ref[Y], g_ref[Z], 0.0, 1.0, 0.0);
HMatrix arcball_rot;
Ball_Value(g_arcBall,arcball_rot);
glMultMatrixf((float *)arcball_rot);
//Scale the scene in response to mouse commands.
glScalef(g_zoom, g_zoom, g_zoom);
////////////////////// Draw the geometries in World ////////////////////////
//drawGeom( Object.Geom );
//drawGeom( Rod.Geom );
drawGeom(body.Geom);
drawGeom(middleRightLeg.Geom);
drawGeom(middleLeftLeg.Geom);
drawGeom(middleLeftOuterLeg.Geom);
drawGeom(middleRightOuterLeg.Geom);
drawGeom(brLeg.Geom);
drawGeom(backRightOuterLeg.Geom);
drawGeom(blLeg.Geom);
drawGeom(backLeftOuterLeg.Geom);
drawGeom(frLeg.Geom);
drawGeom(frontRightOuterLeg.Geom);
drawGeom(flLeg.Geom);
drawGeom(frontLeftOuterLeg.Geom);
for (auto i = 0; i < animator.foodParticles.size(); ++i)
{
drawGeom(animator.foodParticles.at(i).odeObject.Geom, animator.foodParticles.at(i).colored );
}
drawGeom(target.Geom);
glPushMatrix(); //Draw the collision plane.
glTranslated( 0.0, -0.05, 0.0 );
glScaled( 140.0, 0.1, 140.0 );
GDrawing::setColor( 0.4, 0.4, 1.0 );
GDrawing::drawCube();
glPopMatrix();
////////////////////////////////////////////////////////////////////////////
glutSwapBuffers();
if( g_recording == 1)
g_frameSaver.DumpPPM(g_width,g_height);
}