Graphics are going white?

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
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Graphics are going white?

Post by danielmccarthy »

Hi,
I am loading my graphics and if they are loaded when the program is only just starting up for example in the Game class constructor it loads up fine. When ever I try to load it after the game has loaded I have issues and the graphics go white.

Image

Here is my code:

Code: Select all

 
void ItemSlot::createItem(u16 _itemId, u32 _quantity, u16 x, u16 y)
{
    this->itemId = _itemId;
    this->itemQuantity = _quantity;
 
    std::wstring stackTxt = L"";
    /* We only want to set a quantity in the stackTxt if the quantity is above 1 */
    if (_quantity > 1)
    {
    /* If you have a large amount of a particular item. You do not want the text taking up a lot of the item
     * slot. To solve this we can split the quantity into K's and M's to represent thousands and millions.
     * This has been achieved below.*/
        wchar_t addOn = L' ';
        if(_quantity > 10000000)
        {
            _quantity = _quantity / 1000000;
            addOn = L'M';
        }
        else if (_quantity > 100000)
        {
            _quantity = _quantity / 1000;
            addOn = L'K';
        }
        stackTxt = Misc::to_wstring(_quantity) + addOn;
 
    }
 
    int invItemX = x;
    int invItemY = y;
    int invItemWidth = 40;
    int invItemHeight = 40;
    this->invItem = guienv->addButton(rect<s32>(invItemX, invItemY, invItemX + invItemWidth, invItemY + invItemHeight), this->parent, _itemId, L"", ItemHandler::getItemName(_itemId).c_str());
    invItem->setName("inventory_item");
    ITexture* tex = driver->getTexture(ItemHandler::getItemIconLocation(_itemId).c_str());
    invItem->setImage(tex);
    invItem->setUseAlphaChannel(true);
    invItem->setDrawBorder(false);
    this->itemStackTxt = guienv->addStaticText(stackTxt.c_str(), core::rect<s32>(0, 0, 50, 20), false, false, invItem, _itemId);
    this->itemStackTxt->setName("inventory_item");
}
 
 
The graphics are also loaded as I have no output in the console to say otherwise and also because I checked with an if statement earlier on
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Graphics are going white?

Post by CuteAlien »

Sorry, not really possible to figure it out from the code above. getTexture does not care when it's called, so it's something else...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Graphics are going white?

Post by danielmccarthy »

The code above is what is loading the texture could it be a bug with .PNG images?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Graphics are going white?

Post by CuteAlien »

Unlikely. You can also check the return value. But if it loads then it's more likely the bug is in another part of your application. Like you might not be applying it to the object you think you're applying it to or something like that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Graphics are going white?

Post by danielmccarthy »

Hi guys,

I changed the driver to the Irrlicht software driver and it works fine. Sounds to me like its a bug in the Opengl driver.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Graphics are going white?

Post by CuteAlien »

Extremely unlikely. Sorry, but just texture-loading without doing anything special is so basic that everyone using the engine is doing that all the time. Can't help more with just that code-part you posted (pretty sure that's not containing the real problem).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply