Exemplo n.º 1
0
int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ACCUM);
    glutInitWindowSize(600,600);
    glutCreateWindow("glLaserCanvas");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);

    long sync = 1;
    CGLContextObj ctx = CGLGetCurrentContext();
    CGLSetParameter (ctx, kCGLCPSwapInterval, &sync);  
    
    // have to init input to find the sample rate before setting up the filters
    input_init();
    biquad_lpf(&lpf_x, 1500, 0.6);
    biquad_lpf(&lpf_y, 1500, 0.6);

    glLoadIdentity();
    glDrawBuffer(GL_FRONT);
    glClearColor(0,0,0,1);
    glClearAccum(0,0,0,1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ACCUM_BUFFER_BIT);
    glDrawBuffer(GL_BACK);
    glReadBuffer(GL_BACK);
    glAccum(GL_RETURN, 1.0);
    //glutSwapBuffers();
    
    glutMainLoop();
    return 0;
}
Exemplo n.º 2
0
void bf_est_reset(short fill) {
    biquad_lpf(&bf_drift_lpf, 1.0/180.0, 0.3);
    biquad_lpf(&bf_err_lpf, 1.0/10.0, 0.25);
    biquad_lpf(&bf_err_deriv_lpf, 1.0/2.0, 0.2);
    fill_count = 0;
    bf_playback_rate = 1.0;
    bf_est_err = bf_last_err = 0;
    desired_fill = fill_count = 0;
}