Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda