Jump to content
  • Advertisement
Sign in to follow this  

setting color in irrlicht

This topic is 4004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I need to set the color of a SphereSceneNode in Irrlicht Nothing fancy, I'm looking for something like item->setColor(r,g,b) is there an easy way to do that? thanks Nicola

Share this post

Link to post
Share on other sites
There is no easy way to do this in Irrlicht. You can do it this way:

// Create a new texture and set it so we can draw to it.
ITexture * target = driver->createRenderTargetTexture(dimension2d<s32>(128, 128));

// Fill the texture with the color of your choice.
SColor yourColor(255, 255, 200, 0); // a r g b
driver->draw2DRectangle(yourColor, rect<s32>(position2d<s32>(0,0),position2d<s32>(128,128)));

// Set the render target back to the screen.

ISceneNode * yourSceneNode; // this variable contains your SphereSceneNode

// Set the color texture
yourSceneNode->setMaterialTexture(0, target);

I haven't attempted to compile it.

Share this post

Link to post
Share on other sites
first of all thank you;
the code compiles fine, but I get the spheres completely black
i tried changing alpha values, colors, .. but still black
any idea?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!