oscP5, can't draw shapes from inside the oscEvent function

I am fairly new to processing but have experience in other languages. I am using the oscP5 library to send coordinates from Unity to processing over osc.

However, I am having an issue with drawing shapes from within the oscEvent function. This snippet is from within the oscEvent function.

    else if(theOscMessage.addrPattern().equals(ballPattern)){
        float oscX = theOscMessage.get(0).floatValue();
        float oscY = theOscMessage.get(1).floatValue();
        
        println("#OSC# Recieved message: "+theOscMessage.addrPattern()+"  x:"+oscX+"  y:"+oscY);
        drawPaintball(oscX,oscY);
    }

When drawPaintball() is called, the data is sent through and processed properly (I can see it is correct in the console and debug menu) but the ellipse is not drawn.

void drawPaintball(float x, float y)
{
  float newX = abs(x) * (width * 2);
  float newY = abs(y) * (height * 2);
 
  println("Paintball on "+newX+" "+newY); 
  ellipse(newX,newY, 40, 40);
}

When I call this function from outside the oscEvent function, it works as is intended. I have also tried calling the ellipse() function within the oscEvent function and hard-coding the values, which also doesn’t draw an ellipse().

I appreciate any help.

1 Like

Thanks for the reply, this has helped a lot!