Flashy Drawing

I have a movable camera, and a small isometric field, and whenever I move the camera, the field flashes a lot(randomly draws, then doesn’t draw, then draws again). Is there any way I can fix this? Do I need to double buffer?

I can’t really help here, but… I can ask some leading questions that might help others: What library are you using to draw these things? If it’s a specific library what are the classes that you’re using? And perhaps posting a code snippet of your update/draw method might help.

Its in pure java in a repaint method:

public void paint(Graphics g) {
		super.paint(g);
		
		map.render(g);
        
		g.dispose();
	}

I never used g.dispose() at the end of a paint method. Maybe it’s the reason for the flashing? Why did you add that?

  1. You need to double buffer.
  2. Never call dispose() on a Graphics that you didn’t .create() in the first place.

Cas :slight_smile:

Alright, the flickering decreased by alot, something I can work with. i’ll try to double buffer later. thanks for the help