Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
How does background function work in Processing?

Yo, I hope all is fine for you! As indicated in the title, I would like to know how background function works in Processing. What is the difference between the first program (background called before drawing the circle) and the second program (background called after drawing the circle) which is the one "doesn't working"?

int x = 1;
void setup() {
  size(400, 400);
  background(255);
}

void draw() {
  background(255);
  circle(200 + x, 200, 20);
  x++;
}
int x = 1;
void setup() {
  size(400, 400);
  background(255);
}

void draw() {
  circle(200 + x, 200, 20);
  background(255);
  x++;
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

background not only defines the background color, but also fills the window with the background color. Therefore you have to call background before drawing the objects of the scene:

void draw() {
  background(255);
  circle(200 + x, 200, 20);
  x++;
}

background clears the window and thereby all previously drawn objects. background does not change a state. When you call background, every pixel in the window is instantly changed. (Since processing uses OpenGL, glClear is invoked under the hood.)

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda