Clear screen ?

Hi everybody, I’m newbie in Panda3d. I want to clear screen with my specific color before drawing anything. What should I do ?

Welcome to the forums!

Here’s the code you are looking for:

Colorf myColor(0, 0, 0, 0); // black
windowFramework->get_graphics_window()->get_active_display_region(0)->set_clear_color(myColor);

Where windowFramework is the pointer you got when opening your Panda3d window (i.e. the call to PandaFramework::open_window)

Thanks for your help !

You’re welcome :slight_smile:

Just found out about these higher level functions you sh/could use as well:
WindowFramework::get_display_region_3d
then you call on
DrawableRegion::set_clear_color

or, more to the point
WindowFramework::set_background_type
and
PandaFramework::set_background_type

Cheers!