[no bug]Transparent Windows

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

[no bug]Transparent Windows

Post by slavik262 »

When it was released, I switched from 1.6 to 1.6.1 for a major project I'm working on.

For whatever reason, in 1.6.1, all windows created with IGUIEnvironment::addWindow() are transparent. I don't know how to fix this and it's quite annoying. I've tried it on all the drivers and I still get the same result. To make sure it wasn't some other code, I threw together a test and it still did the same thing.

Image

Code: Select all

#include <irrlicht.h>

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

using namespace irr;
using namespace core;
using namespace video;
using namespace gui;

int main(void)
{
	IrrlichtDevice* device = createDevice();

	IVideoDriver* vd = device->getVideoDriver();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	guienv->addWindow(rect<s32>(100, 100, 500, 500), false, L"Test Window");

	while(device->run())
	{
		if(device->isWindowActive())
		{
			vd->beginScene(true, true, SColor(255, 0, 0, 255));
			guienv->drawAll();
			vd->endScene();
		}
		else
			device->yield();
	}
	return 0;
}
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

try setting the skin color.

Code: Select all

mySkin = guienv->getSkin();

Code: Select all

  // Window BG
  mySkin->setColor(EGDC_3D_FACE, SColor (255, 0,0,0));
  mySkin->setColor(EGDC_3D_SHADOW, SColor (255, 0,0,0));

  // Titlebar Text
  mySkin->setColor(EGDC_ACTIVE_CAPTION, SColor (255, 255,255,255));

  // Titlebar BG
  mySkin->setColor(EGDC_ACTIVE_BORDER, SColor (255, 0,0,0));

  // Border
  mySkin->setColor(EGDC_3D_DARK_SHADOW, SColor (255, 0,0,0));
  mySkin->setColor(EGDC_3D_HIGH_LIGHT, SColor (255, 0,0,0));

  // Button Text
  mySkin->setColor(EGDC_BUTTON_TEXT, SColor (255, 255,255,255));

  // Selected ListBox Item Text
  mySkin->setColor(EGDC_HIGH_LIGHT_TEXT, SColor (255, 255,255,255));

  // Selected ListBox Item BG
  mySkin->setColor(EGDC_HIGH_LIGHT, SColor (255, 0,0,100));

  // Textbox BG
  mySkin->setColor(EGDC_WINDOW, SColor (255, 0,0,0));

  // Scrollbar Arrows
  mySkin->setColor(EGDC_WINDOW_SYMBOL, SColor (255, 255,255,255));

  // Scrollbar, EditBox BG
  mySkin->setColor(EGDC_SCROLLBAR, SColor (255, 50,50,50));
Never take advice from someone who likes to give advice, so take my advice and don't take it.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

Granted, but doesn't the default skin have an initial window color value?
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Window color can have an alpha value...? Is it a driver issue on your machine? Have you tested it on any other machines?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

I just tried setting the skin to a built-in skin just to make sure that wasn't the problem. The same issue still occurred. I've tried this on two machines so far (a laptop with integrated graphics running Vista and a desktop PC with 7 and a GeForce GTX260).

I just fixed it by setting the background colors manually.

Still, should the default ones have an alpha value besides 255? That seems odd to me.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Most elements use an alpha of 101 to render themselves. This can be changed as shown in the examples.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

I'm aware of how to change the values, but why start most controls with more than half transparency? It seems like a bit of a nuisance. GUIs aren't generally transparent...
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

maybe to show its capability of being transparent :D
Never take advice from someone who likes to give advice, so take my advice and don't take it.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The GUI is very often just an overlay over the scene, so it's not uncommon to have transparency in the GUI. Just like most GUIs on modern OSes.
Question should be why you didn't see this behavior in 1.6, because this has been in Irrlicht ever since.
Post Reply