Loading...
Logo
Processing Forum
Hi I want to use a second window, using GWindow, to plot a graph with realtime input. (let's say mouse position)
The problem is that also if I don't put 'background()' neither in the main draw() nor in the GWindow draw(), the second window always refresh as if i was calling background() each cycle.
This way I cannot plot a graph, because each cycle the GWindow is blanked.

Can someone help me?

Linuxmint 13 and latest processing/G4P library.
here is some code to reproduce the issue:
Copy code
  1. import g4p_controls.*;

    GWindow       NewWindow;

    void setup() {
      size(400,400,JAVA2D);
      background(100,30,30);
      NewWindow = new GWindow(this, "Scope Window", 0, 50, 600, 380, false, JAVA2D);
      NewWindow.addDrawHandler(this, "NewWindow_Draw");
    }

    void draw() {
      stroke(255);
      if(mousePressed) {
        line(mouseX, mouseY, pmouseX, pmouseY);
      }
    }

    void NewWindow_Draw(GWinApplet appc, GWinData data) {
      if(appc.mousePressed) {
        appc.line(appc.mouseX, appc.mouseY, appc.pmouseX, appc.pmouseY);
      }
    }

Replies(2)

Re: G4P GWindow issue.

8 months ago
After you have created the new window add the line

NewWindow.setAutoClear(false);

This will stop the background being cleared each frame.

Re: G4P GWindow issue.

8 months ago
Thanks Quarks, that is what i was looking for.