Why can't I write on the virtual device?

Why does the virtual device doesn't present the sprintf? It does open the window and sets the background color, but doesn't present anything else in the window (like the sprintf and g2_string commands).

char str[256];

case'2':

    dev=g2_open_X11(750, 500); 
    d=g2_open_vd();
    g2_clear(d);
    g2_set_font_size(d, 14); 
    g2_attach(d, dev); 

    g2_set_auto_flush(d, 0);
    g2_pen(d, 0);
    g2_set_background(d, 1);

    sprintf(str, "Atitude:   %.4f graus", alfa);
    g2_string(d, 30, 250, str);

    sprintf(str, "Altitude:   %.4f m", ht);
    g2_string(d, 30, 230, str);

    sprintf(str, "Distancia horizontal:   %.4f m", xt);
    g2_string(d, 30, 210, str);

    sprintf(str, "Velocidade em x:   %.4f m/s", vxt);
    g2_string(d, 30, 190, str);

    sprintf(str, "Velocidade em z:   %.4f m/s", vzt);
    g2_string(d, 30, 170, str);

    sprintf(str, "Combustivel:   %.4f Kg", m_comb);
    g2_string(d, 30, 150, str);
break;

Upvotes: 0

Views: 64

Answers (1)

nobody
nobody

Reputation: 20174

Assuming this is the library you're using, you need to either enable auto-flush (you've disabled it with the g2_set_auto_flush(d, 0); call) or call g2_flush whenever you've completed a batch of operations that you want to appear.

Upvotes: 1

Related Questions