Author Topic: Can I blit some part from texture, and set it transparent?  (Read 3229 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
Can I blit some part from texture, and set it transparent?
« on: January 09, 2007, 10:07:30 pm »
The thing is that:
      I need a transparent log on the left top of the jPCT world, and I also notice that  some words blitted from a texture look much better if they are in a transparent background.
     So Can I blit some parts from a texture( a picture, maybe GIF, JPG or PNG), and set the parts transparent?
     It is not the issue about FrameBuffer.TRANSPARENT_BLITTING or FrameBuffer.OPAQUE_BLITTING, when I set the  FrameBuffer.TRANSPARENT_BLITTING, the background will be missed if it is black, and if not black, the background will be there. But I need it is transparent.

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Can I blit some part from texture, and set it transparent?
« Reply #1 on: January 09, 2007, 10:25:05 pm »
I guess you cannot blit a semi transparent texture, maybe if you texture has many black points on it that may be look trasnparent, but this is not a real solution if you log has small letters.
Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Can I blit some part from texture, and set it transparent?
« Reply #2 on: January 10, 2007, 12:11:39 am »
When using the software renderer, then no. You would have to do the transparency yourself on the bitmap level (not that hard).
When using the hardware renderer, then yes. You can load a Texture with an alpha channel (a PNG with alpha will work fine) to define the transparent/translucent parts and blit that in transparent mode. There are constructors for textures with alpha-channel in Texture.

Edit: An example using this picture:

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
Can I blit some part from texture, and set it transparent?
« Reply #3 on: January 10, 2007, 04:00:49 pm »
Thanks.
I will try.

And I want to thank EgonOlsen and all the guys in the forum. You all really help me a lot.

And I will help out to others if I can about this excellent engine.

:)