Author Topic: Blit for Textures?  (Read 2489 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Blit for Textures?
« on: March 25, 2011, 05:34:18 pm »
Is there anything like blit(....) but for texture?  :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Blit for Textures?
« Reply #1 on: March 26, 2011, 08:50:54 am »
No. Either use an ITextureEffect for this or compose your texture from different bitmaps, if this is really needed.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Blit for Textures?
« Reply #2 on: March 26, 2011, 09:50:29 am »
I really do not know how to use ITextureEffect... Have you any simple example of this? Say I have this green texture and I want to place the scaled red texture as shown the image.

« Last Edit: March 26, 2011, 09:55:34 am by Thomas. »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Blit for Textures?
« Reply #3 on: March 28, 2011, 11:30:18 am »
int[] dest and int[] source are what? Thase are the colors (0x000000)? what y or x coordinates???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Blit for Textures?
« Reply #4 on: March 28, 2011, 12:09:57 pm »
RGB color values. You can set single pixels of the texture with that.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Blit for Textures?
« Reply #5 on: March 28, 2011, 03:07:25 pm »
say I have texture 16x16 and I want set color in point[10,2], is correct if I use dest[26] = 0x000000;?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Blit for Textures?
« Reply #6 on: March 28, 2011, 09:24:58 pm »
The index is y*16+x in that case. Remember that x and y both start at 0.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Blit for Textures?
« Reply #7 on: March 28, 2011, 10:23:17 pm »
I don't see any method like is texture.getArray(), so how can I get colors from other texture?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Blit for Textures?
« Reply #8 on: March 29, 2011, 08:43:10 am »
You can (ab)use another ITextureEffect just to grab that data. However, i'm not sure if this is really the best solution to an (for me) unknown problem. Maybe we should take back one step and ask what the actual goal of all this is!?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Blit for Textures?
« Reply #9 on: March 29, 2011, 09:00:02 am »
Still same problem, I have elevator with many floors and I want edit texture depending on where is elevator... I have one texture and I need another texture place into first one...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Blit for Textures?
« Reply #10 on: March 29, 2011, 09:20:23 am »
Then why not model the floor display as a simple plane and switch it's texture? It's cheaper and easier than any other solution IMHO.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Blit for Textures?
« Reply #11 on: March 29, 2011, 09:46:01 am »
My english is very bad and I don't know how to describe it... panels that shows floors of elevator are interactive and I can choose floor by touch on screen and I want use scale effect of text during the choosing process :)
So, the best solution for this is ITextureEffect, or...?
« Last Edit: March 29, 2011, 10:21:45 am by Thomas. »

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Blit for Textures?
« Reply #12 on: July 11, 2011, 12:31:28 am »
ITextureEffect is very slow (from 55 to 24 fps), is there any other solution for this? blit another texture to first one....
« Last Edit: July 11, 2011, 08:35:07 am by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Blit for Textures?
« Reply #13 on: July 11, 2011, 02:58:19 pm »
Uploading new texture data is expensive and not meant to be done every frame. Is this still about the floor display in an elevator? If so, then i still think that rendering all floor numbers into a texture use either the PolygonManager or a texture matrix is the better solution.