Program Colored Background

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
dlannetts
Posts: 3
Joined: Wed Aug 18, 2010 11:51 am

Program Colored Background

Post by dlannetts »

Hi, i have read through most of the tutorials but i couldn't find anything on how to add a background color to the program, i have started to build a program and i would like a black background if i may, but am unsure on how to do this, does it involve something along the lines on loading a texture and picking pixels from the texture to apply to the background?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

have a look at the driver->beginScene(...) command, it takes a color parameter for the background !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

If you want images for a background, take a look at sky boxes and domes.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

And if you want static 2D images as background take a look at IVideoDriver::draw2DImage or IGUIEnvironement::addImage / IGUIImage::setImage from the documentation.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hmmm, using gui images could be problematic, as you usually draw the gui after the scene... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
anoki
Posts: 58
Joined: Fri May 05, 2006 8:31 am

Post by anoki »

This code creates a black backround.

driver->beginScene(true, true, video::SColor(0,0,0,0));


The whole code can be found here.

http://irrlicht.sourceforge.net/docu/example002.html
dlannetts
Posts: 3
Joined: Wed Aug 18, 2010 11:51 am

Post by dlannetts »

Yeah righto thanks for this guys, i have this::

driver->beginScene(true, true, SColor(0,0,0,0));

So i am confused with something else, how can (0,0,0,0) make colors? is there like a color chart or something people follow to figure this out? And for now i am just building a flat black background, but please if you understand how colors are made from (0,0,0,0) please tell, l am very interested...
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Post by Dareltibus »

these 4 arguments are the 4 color components

the first is Alpha (transparency)
the second is Red
the 3rd is Green
the 4th is Blue.

usally they can be setted from 0 to 255.

Alpha is ininfluent if you use it only for the background color so you can set it freely (for now)

if you want set a specific color you have to select the color for example with "paint" and look at the three components. if you want pure red as BG color you have to set

(0,255,0,0)

for the yellow:
(0,255,255,0)

ecc...

don't expect to find colors as

Baground->setColor("blue");.

Irrlicht for now use only number for colors' compontent and this is the best way.
dlannetts
Posts: 3
Joined: Wed Aug 18, 2010 11:51 am

Post by dlannetts »

WOW!!! thank you so much Dareltibus, this was the exact type of answer i was after, this is very helpful, thanks a lot guys and girls...
Post Reply