Jump to content

[SOLVED] ObjectGui + WidgetSprite = Green


photo

Recommended Posts

Posted

Hi, it's me again asking questions about WidgetSprite.  I have a new issue here.

 

Every image I load into the WidgetSprite and show on the ObjectGui ends up tinted green.  I have attached two images showing the original image and what shows up on the ObjectGui.

 

It doesn't matter if I load the image by passing in the file path in the constructor to WidgetSprite, or if I pass in a regular Image.  I've tried it with a few different images, and they all show up green.

 

I've tried swapping the channels around in the image...funny thing is that it makes no difference.  The image still shows as green.

 

I've tried creating a procedural Image and setting its pixels like this:

 

 

  for (int y = 0; y < 1080; y++)
  {
   for (int x = 0; x < 1920; x++)
   {
    image->set2D(x, y, Image::Pixel(255, 0, 0, 255));
   }
  }
  sprite->setLayerImage(0, image, 1);

 

The funny thing is that when I do it this way, the channels are all scrambled.  The docs say Image::Pixel takes r,g,b, and a in that order.  But this code causes my image to be green.  When I change which channel is written to, I get other weird results, writing 255 to the green channel ends up being blue and writing 255 to the blue channel ends up being red.  So it's like Image::Pixel is actually taking arguments of g, b, r instead. 

 

However, even if I swap the channels in my image such that I'm putting them in that order (g, b, r), the image still shows up as green. 

 

One other weird thing.  If any objects in my scene pass in front of the ObjectGui, they leave a trail behind them.  It's like the ObjectGui is blending with previous frames or something.

 

Any ideas?

 

Thanks.

post-1922-0-59702200-1461956345_thumb.png

post-1922-0-61133800-1461956352_thumb.png

Posted

I figured it out.

 

I had set the "mode" parameter on gui_base to 1, which turns on YUV color space. 

 

I did this because I had originally copied the code from one of the script demos that demonstrates WidgetSpriteVideo, and that video happened to be in YUV color space.

×
×
  • Create New...