Author Topic: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?  (Read 4134 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
I'm trying to write a widget whose background is transparent and, to do so, I need to be able to set the pixels alpha values. Since the transparency isn't working, I'm starting to question whether the FrameBuffer ignores its alpha value. Please help, Egon, I really need this to work!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #1 on: April 19, 2010, 09:54:13 pm »
Yes, it ignores it. I never saw a reason to clear with alpha, but i've already changed that for jPCT-AE on request and now for "desktop" jPCT too. Get the latest beta here: http://www.jpct.net/download/beta/jpct.jar and see if this helps.

Just to be sure: We are talking about the hardware renderer here? Because if not, then this is a different story...

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #2 on: April 19, 2010, 10:33:39 pm »
Thanks a lot, pal.

Why's software a different story?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #3 on: April 19, 2010, 11:15:19 pm »
Because it doesn't support it yet... :P

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #4 on: April 19, 2010, 11:22:26 pm »
Oh, I thought there was a big reason behind it. :- )

Anyway, if you needed a reason to implement it, this is a big one: http://java.sun.com/docs/books/tutorial/uiswing/misc/trans_shaped_windows.html

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #5 on: April 20, 2010, 01:00:55 pm »
i suppose it's partially supported by SW renderer. see Config.useFramebufferWithAlpha

combining it with a semi transparent background, you can have effects like below. or combine with a semi transparent frame like in the link you posted..

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #6 on: April 20, 2010, 07:58:30 pm »
Thanks for the suggestion. But now I can't seem to clear the screen anymore. I've even tried clear() with no color arguments, but when I turn off Config.useFramebufferWithAlpha, clearing works again.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #7 on: April 20, 2010, 08:24:12 pm »
I forgot about this setting...so yes, software supports it too. It even applies a colors alpha value when clearing just like hardware mode does.

@AGP: I don't really understand which renderer you need this for, because you seemed to be happy with the change for the hardware renderer but say that useFramebufferWithAlpha disables clearing, which it can't do with hardware, because it has no effect on it!?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Does FrameBuffer.clear(new Color(0, 0, 0, 0)) ignore its alpha value?
« Reply #8 on: April 20, 2010, 08:42:58 pm »
I'm happy to have either, but I would lilke for it to work for me in software as well (for compatibility reasons).