Archive 17/01/2023.

Background Color

freegodsoul

Is there a simple method of setting a background color of a viewport or of a whole scene without creating Zone object (example 05_AnimatingScene) ?
I want something like Ogre’s Viewport::setBackgroundColour() or Unity’s Camera.backgroundColor. Thanks!

codingmonkey

You may try to change RenderPath clear color value
get RP from viewport and find clear command
or change xml file forward.xml

freegodsoul

[quote=“codingmonkey”]You may try to change RenderPath clear color value
get RP from viewport and find clear command
or change xml file forward.xml[/quote]

I’ve put this code right after viewport initialization, and everything works well:

	RenderPath * rp = viewport->GetRenderPath();
	for ( int i = 0; i < rp->GetNumCommands(); i++ )
	{
		RenderPathCommand * cmd = rp->GetCommand( i );
		if ( cmd->type_ == RenderCommandType::CMD_CLEAR )
		{
			cmd->useFogColor_ = false;
			cmd->clearColor_ = Color( 0.2f, 0.25f, 0.3f, 1.0f );
		}
	}

Thank you, CodingMonkey!