本文整理汇总了C++中FrameSaver::DumpPPM方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameSaver::DumpPPM方法的具体用法?C++ FrameSaver::DumpPPM怎么用?C++ FrameSaver::DumpPPM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameSaver
的用法示例。
在下文中一共展示了FrameSaver::DumpPPM方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例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, 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) ;
}
示例3: 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();
}
示例4: 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) ;
}
示例5: 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() ;
}
示例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
//.........这里部分代码省略.........
{
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);
model_view *= RotateY(-5400 + TIME*360);
}
// backflip thing
else if (TIME >= 16 && TIME < 16.5)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0, 23);
model_view *= RotateX(5040 - TIME*720);
}
//walk backwards
else if (TIME >= 16.5 && TIME < 17)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0, 23);
model_view *= Translate (0, 0, 264 - TIME*16);
}
//fall
else if (TIME >= 17 && TIME < 17.5)
{
model_view *= RotateY(180);
model_view *= Translate (0, 0, 15);
model_view *= Translate (0, (17*9) - TIME*9, 0);
model_view *= RotateX (3060 - TIME*180);
}
// lay on ground
else if (TIME >= 17.5)
{
model_view *= RotateY(180);
model_view *= Translate (0, -4.5, 15);
model_view *= RotateX (-90);
}
drawGuy1();
model_view = mvstack.pop();
//GUY 2
mvstack.push(model_view);
model_view *= Translate (-20, 8, 35);
model_view *= Scale(1.5, 1.5, 1.5);
model_view *= RotateY(180);
if (TIME >= 6 && TIME < 8)
{
model_view *= Translate(39 - TIME*6.5, 0, 0);
model_view *= RotateY(270 - TIME*45);
}
else if( TIME >= 8 && TIME < 10)
{
model_view *= Translate (-13, 0, 0);
model_view *= Translate (0, 0, -(8*10.5) + TIME*10.5);
}
else if (TIME >= 10 && TIME < 15)
{
model_view *= Translate (-13,0, 21);
model_view *= RotateY(3*sin(5*TIME));
}
else if (TIME >= 15 && TIME < 26.5)
{
model_view *= Translate(-13, 0, 21);
}
else if (TIME >= 26.5 && TIME < 28.5)
{
model_view *= Translate (-13, 0, 21);
model_view *= Translate (0, 0, (26.5*5) - TIME*5);
}
else if (TIME >= 28.5 && TIME < 29.5)
{
model_view *= Translate (-13, 0, 11);
model_view *= RotateY((180*28.5) - TIME*180);
}
else if (TIME >= 29.5 && TIME < 31.5)
{
model_view *= Translate(-13, 0, 11);
model_view *= RotateY(180);
model_view *= Translate (0, 0, -(29.5*15) + 15*TIME);
}
drawGuy2();
model_view = mvstack.pop();
cam();
if (TIME > 31.5)
exit(0);
glutSwapBuffers();
if(Recording == 1)
FrSaver.DumpPPM(Width, Height) ;
}
示例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
//.........这里部分代码省略.........
}
/*/
//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);
}
drawDiaoSi(0.3f, 0.6f, .6f);
model_view = mvstack.pop();
// Draw Female
if(timeline > 8.0f) {
mvstack.push(model_view);
if(timeline < 12.0f) {
model_view *= Translate(29.0f-2*timeline, -1.25f, 4.5f);
model_view *= RotateY(-90);
}
if(timeline > 12.0f && timeline < 13.5) {
model_view *= Translate(5.0f, -1.25f, 4.5f);
model_view *= RotateY(-90+temp*1.25);
}
if(timeline > 13.5f && timeline < 40.0f || timeline > 53.75)
model_view *= Translate(5.0f, 0.0f, 2.25f);
if(timeline >= 40.0f && timeline < 59.0f) {
model_view *= Translate(5.5f+temp6/4, -1.25f, 4.5f);
model_view *= RotateY(90);
}
/*/ if(timeline > 50.0f && timeline < 53.75) {
if(15.0f-(temp2-560)/10 > 5.0) {
model_view *= Translate(15.0-(temp2-560)/10, -1.25f, 4.5f);
prevY = 15.0-(temp2-560)/10;
}
else
model_view *= Translate(prevY, -1.25f, 4.5f);
if(timeline < 52.6f)
model_view *= RotateY(-90);
else
model_view *= RotateY(-90+temp*2);
}
/*/
if(timeline < 59.0)
drawFemale(1.0f, 0.0, 1.0f);
//else
// drawFemale(1.0f, 1.0f, 1.0f);
model_view = mvstack.pop();
}
if(timeline > 59.0)
exit(0);
getFPS();
glutSwapBuffers();
if(Recording == 1)
FrSaver.DumpPPM(Width, Height) ;
}
示例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);
}