本文整理汇总了C++中do_fps函数的典型用法代码示例。如果您正苦于以下问题:C++ do_fps函数的具体用法?C++ do_fps怎么用?C++ do_fps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_fps函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_voronoi
ENTRYPOINT void
draw_voronoi (ModeInfo *mi)
{
voronoi_configuration *vp = &vps[MI_SCREEN(mi)];
Display *dpy = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (!vp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(vp->glx_context));
glShadeModel(GL_FLAT);
glEnable(GL_POINT_SMOOTH);
/* glEnable(GL_LINE_SMOOTH);*/
/* glEnable(GL_POLYGON_SMOOTH);*/
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LEQUAL);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mi->polygon_count = 0;
draw_cells (mi);
move_points (vp);
prune_points (vp);
state_change (mi);
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(dpy, window);
}
示例2: draw_hypertorus
/*
*-----------------------------------------------------------------------------
* Called by the mainline code periodically to update the display.
*-----------------------------------------------------------------------------
*/
ENTRYPOINT void draw_hypertorus(ModeInfo *mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
hypertorusstruct *hp;
if (hyper == NULL)
return;
hp = &hyper[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if (!hp->glx_context)
return;
glXMakeCurrent(display,window,*(hp->glx_context));
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
display_hypertorus(mi);
if (MI_IS_FPS(mi))
do_fps (mi);
glFlush();
glXSwapBuffers(display,window);
}
示例3: draw_atlantis
/*
*-----------------------------------------------------------------------------
* Called by the mainline code periodically to update the display.
*-----------------------------------------------------------------------------
*/
ENTRYPOINT void
draw_atlantis(ModeInfo * mi)
{
atlantisstruct *ap = &atlantis[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
MI_IS_DRAWN(mi) = True;
if (!ap->glx_context)
return;
glXMakeCurrent(display, window, *(ap->glx_context));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(current_device_rotation(), 0, 0, 1);
AllDisplay(ap);
Animate(ap);
glPopMatrix();
if (mi->fps_p) do_fps (mi);
glXSwapBuffers(display, window);
}
示例4: draw_screenflip
ENTRYPOINT void draw_screenflip(ModeInfo *mi)
{
Screenflip *c = &screenflip[MI_SCREEN(mi)];
Window w = MI_WINDOW(mi);
Display *disp = MI_DISPLAY(mi);
if (!c->glx_context)
return;
/* Wait for the first image; for subsequent images, load them in the
background while animating. */
if (c->waiting_for_image_p && c->first_image_p)
return;
glXMakeCurrent(disp, w, *c->glx_context);
glBindTexture(GL_TEXTURE_2D, c->texid);
if (c->regrab)
getSnapshot(mi);
display(c, MI_IS_WIREFRAME(mi));
if(mi->fps_p) do_fps(mi);
glFinish();
glXSwapBuffers(disp, w);
}
示例5: draw_extrusion
/* draw the extrusion once */
ENTRYPOINT void
draw_extrusion(ModeInfo * mi)
{
extrusionstruct *gp = &Extrusion[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
static const GLfloat color[4] = {0.6, 0.6, 0.4, 1.0};
/* static const GLfloat spec[4] = {0.6, 0.6, 0.6, 1.0}; */
/* static const GLfloat shiny = 40.0; */
double x, y, z;
if (!gp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(gp->glx_context));
glPushMatrix();
gltrackball_rotate (gp->trackball);
get_rotation (gp->rot, &x, &y, &z,
!(gp->button_down_p || gp->button2_down_p));
glRotatef (x * 360, 1.0, 0.0, 0.0);
glRotatef (y * 360, 0.0, 1.0, 0.0);
glRotatef (z * 360, 0.0, 0.0, 1.0);
/* track the mouse only if a button is down. */
if (gp->button2_down_p)
{
gp->mouse_dx += gp->mouse_x - gp->mouse_start_x;
gp->mouse_dy += gp->mouse_y - gp->mouse_start_y;
gp->mouse_start_x = gp->mouse_x;
gp->mouse_start_y = gp->mouse_y;
}
{
float scale = (max_lastx - min_lastx);
get_position (gp->rot, &x, &y, &z,
!(gp->button_down_p || gp->button2_down_p));
lastx = x * scale + min_lastx + gp->mouse_dx;
lasty = y * scale + min_lasty + gp->mouse_dy;
}
glScalef(0.5, 0.5, 0.5);
/* glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, spec); */
/* glMateriali (GL_FRONT_AND_BACK, GL_SHININESS, shiny); */
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
glFrontFace(GL_CCW);
funcs_ptr[gp->extrusion_number].DrawStuff();
glPopMatrix();
if (mi->fps_p) do_fps (mi);
glXSwapBuffers(display, window);
}
示例6: draw_bubble3d
ENTRYPOINT void
draw_bubble3d(ModeInfo * mi)
{
struct context *c = &contexts[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
MI_IS_DRAWN(mi) = True;
if (!c->glx_context)
return;
glXMakeCurrent(display, window, *(c->glx_context));
glb_config.polygon_count = 0;
glPushMatrix();
glRotatef(current_device_rotation(), 0, 0, 1);
do_display(c);
glPopMatrix();
mi->polygon_count = glb_config.polygon_count;
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}
示例7: draw_gasket
void
draw_gasket(ModeInfo * mi)
{
gasketstruct *gp = &gasket[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
int angle_incr = 1;
if (!gp->glx_context) return;
glDrawBuffer(GL_BACK);
if (max_depth > 10)
max_depth = 10;
MI_IS_DRAWN(mi) = True;
glXMakeCurrent(display, window, *(gp->glx_context));
draw(mi);
/* rotate */
gp->angle = (int) (gp->angle + angle_incr) % 360;
rotate(&gp->rotx, &gp->dx, &gp->ddx, gp->d_max, MI_IS_VERBOSE(mi));
rotate(&gp->roty, &gp->dy, &gp->ddy, gp->d_max, MI_IS_VERBOSE(mi));
rotate(&gp->rotz, &gp->dz, &gp->ddz, gp->d_max, MI_IS_VERBOSE(mi));
/* if (mi->fps_p) do_fps (mi); */
if (MI_IS_FPS(mi)) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}
示例8: draw_ball
ENTRYPOINT void
draw_ball (ModeInfo *mi)
{
ball_configuration *bp = &bps[MI_SCREEN(mi)];
Display *dpy = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (!bp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_CULL_FACE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix ();
glRotatef(current_device_rotation(), 0, 0, 1);
{
double x, y, z;
get_position (bp->rot, &x, &y, &z, !bp->button_down_p);
glTranslatef((x - 0.5) * 6,
(y - 0.5) * 6,
(z - 0.5) * 2);
gltrackball_rotate (bp->trackball);
get_rotation (bp->rot, &x, &y, &z, !bp->button_down_p);
glRotatef (x * 360, 1.0, 0.0, 0.0);
glRotatef (y * 360, 0.0, 1.0, 0.0);
glRotatef (z * 360, 0.0, 0.0, 1.0);
}
mi->polygon_count = 0;
glRotatef (50, 1, 0, 0);
glScalef (4, 4, 4);
glRotatef (bp->th, 0, 0, 1);
if (! bp->button_down_p)
{
bp->th += (bp->th > 0 ? speed : -speed);
while (bp->th > 360) bp->th -= 360;
while (bp->th < -360) bp->th += 360;
}
mi->polygon_count += draw_ball_1 (mi);
glPopMatrix ();
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(dpy, window);
}
示例9: draw_glschool
ENTRYPOINT void
draw_glschool(ModeInfo *mi)
{
Window window = MI_WINDOW(mi);
Display *dpy = MI_DISPLAY(mi);
glschool_configuration *sc = &scs[MI_SCREEN(mi)];
if (!sc->context) {
fprintf(stderr, "no context\n");
return;
}
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(sc->context));
if ((sc->goalCounter % GoalChgFreq) == 0)
newGoal(sc->school);
sc->goalCounter++;
sc->rotCounter++;
sc->rotCounter = (sc->rotCounter%360);
applyMovements(sc->school);
drawSchool(sc->colors, sc->school, sc->bboxList, sc->goalList, sc->fishList, sc->rotCounter, sc->drawGoal, sc->drawBBox);
computeAccelerations(sc->school);
if (mi->fps_p)
do_fps(mi);
glFinish();
glXSwapBuffers(dpy, window);
}
示例10: draw_projectiveplane
/*
*-----------------------------------------------------------------------------
* Called by the mainline code periodically to update the display.
*-----------------------------------------------------------------------------
*/
ENTRYPOINT void draw_projectiveplane(ModeInfo *mi)
{
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
projectiveplanestruct *pp;
if (projectiveplane == NULL)
return;
pp = &projectiveplane[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if (!pp->glx_context)
return;
glXMakeCurrent(display,window,*(pp->glx_context));
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
display_projectiveplane(mi);
if (MI_IS_FPS(mi))
do_fps (mi);
glFlush();
glXSwapBuffers(display,window);
}
示例11: draw_moebius
ENTRYPOINT void
draw_moebius (ModeInfo * mi)
{
moebiusstruct *mp;
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (moebius == NULL)
return;
mp = &moebius[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if (!mp->glx_context)
return;
glXMakeCurrent(display, window, *(mp->glx_context));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0, 0.0, -10.0);
/* Do it twice because we don't track the device's orientation. */
glRotatef( current_device_rotation(), 0, 0, 1);
gltrackball_rotate (mp->trackball);
glRotatef(-current_device_rotation(), 0, 0, 1);
if (!MI_IS_ICONIC(mi)) {
glScalef(Scale4Window * mp->WindH / mp->WindW, Scale4Window, Scale4Window);
} else {
glScalef(Scale4Iconic * mp->WindH / mp->WindW, Scale4Iconic, Scale4Iconic);
}
{
double x, y, z;
get_rotation (mp->rot, &x, &y, &z, !mp->button_down_p);
glRotatef (x * 360, 1.0, 0.0, 0.0);
glRotatef (y * 360, 0.0, 1.0, 0.0);
glRotatef (z * 360, 0.0, 0.0, 1.0);
}
/* moebius */
if (!draw_moebius_strip(mi)) {
release_moebius(mi);
return;
}
glPopMatrix();
if (MI_IS_FPS(mi)) do_fps (mi);
glFlush();
glXSwapBuffers(display, window);
mp->step += 0.025;
}
示例12: draw_antinspect
ENTRYPOINT void draw_antinspect(ModeInfo * mi)
{
antinspectstruct *mp;
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if(!antinspect)
return;
mp = &antinspect[MI_SCREEN(mi)];
MI_IS_DRAWN(mi) = True;
if(!mp->glx_context)
return;
glXMakeCurrent(display, window, *(mp->glx_context));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
mi->polygon_count = 0;
/* position camera --- this works well, we can peer inside
the antbubble */
glTranslatef(0.0, 0.0, -10.0);
# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
{
GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
int o = (int) current_device_rotation();
if (o != 0 && o != 180 && o != -180)
glScalef (1/h, 1/h, 1/h);
glRotatef(o, 0, 0, 1);
}
# endif
gltrackball_rotate(mp->trackball);
glRotatef((15.0/2.0 + 15.0*sin(mp->ant_step/100.0)), 1.0, 0.0, 0.0);
glRotatef(30.0, 1.0, 0.0, 0.0);
glRotatef(180.0, 0.0, 1.0, 0.0);
if (!draw_antinspect_strip(mi)) {
MI_ABORT(mi);
return;
}
glPopMatrix();
if (MI_IS_FPS(mi)) do_fps (mi);
glFlush();
glXSwapBuffers(display, window);
mp->step += 0.025;
}
示例13: draw_jigglypuff
ENTRYPOINT void draw_jigglypuff(ModeInfo *mi)
{
jigglystruct *js = &jss[MI_SCREEN(mi)];
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(js->glx_context));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0,0,-10);
# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
{
GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
int o = (int) current_device_rotation();
if (o != 0 && o != 180 && o != -180)
glScalef (1/h, 1/h, 1/h);
}
# endif
glRotatef(js->angle, sin(js->axis), cos(js->axis), -sin(js->axis));
glTranslatef(0, 0, 5);
if(!(js->button_down)) {
if((js->angle += js->speed) >= 360.0f ) {
js->angle -= 360.0f;
}
if((js->axis+=0.01f) >= 2*M_PI ) {
js->axis -= 2*M_PI;
}
}
gltrackball_rotate(js->trackball);
if(js->color_style == COLOR_STYLE_CYCLE) {
int i;
vector_add(js->jiggly_color, js->color_dir, js->jiggly_color);
for(i=0; i<3; i++) {
if(js->jiggly_color[i] > 1.0 || js->jiggly_color[i] < 0.3) {
js->color_dir[i] = (-js->color_dir[i]);
js->jiggly_color[i] += js->color_dir[i];
}
}
glColor4fv(js->jiggly_color);
}
mi->polygon_count = jigglypuff_render(js);
if(MI_IS_FPS(mi))
do_fps(mi);
glFinish();
update_shape(js);
glXSwapBuffers(MI_DISPLAY(mi), MI_WINDOW(mi));
}
示例14: draw_boing
ENTRYPOINT void
draw_boing (ModeInfo *mi)
{
boing_configuration *bp = &bps[MI_SCREEN(mi)];
Display *dpy = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (!bp->glx_context)
return;
glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
mi->polygon_count = 0;
glShadeModel(GL_SMOOTH);
glEnable(GL_NORMALIZE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (! bp->button_down_p)
tick_physics (mi);
glPushMatrix ();
gltrackball_rotate (bp->trackball);
glLightfv (GL_LIGHT0, GL_POSITION, bp->lightpos);
glDisable (GL_CULL_FACE);
glDisable (GL_DEPTH_TEST);
glEnable (GL_LINE_SMOOTH);
glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
draw_box (mi);
draw_shadow (mi);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
draw_ball (mi);
if (scanlines_p)
draw_scanlines (mi);
glPopMatrix ();
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(dpy, window);
}
示例15: draw_pulsar
ENTRYPOINT void draw_pulsar(ModeInfo * mi)
{
pulsarstruct *gp = &Pulsar[MI_SCREEN(mi)];
Display *display = MI_DISPLAY(mi);
Window window = MI_WINDOW(mi);
if (!gp->glx_context)
return;
glXMakeCurrent(display, window, *gp->glx_context);
drawScene(mi);
if (mi->fps_p) do_fps (mi);
glXSwapBuffers(display, window);
}