www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Thomas. on March 25, 2011, 05:34:18 pm

Title: Blit for Textures?
Post by: Thomas. on March 25, 2011, 05:34:18 pm
Is there anything like blit(....) but for texture?  :)
Title: Blit for Textures?
Post by: EgonOlsen 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.
Title: Blit for Textures?
Post by: Thomas. 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.

 (http://2i.cz/2i/t/160c85af7c.jpg)  (http://2i.cz/160c85af7c)
Title: Blit for Textures?
Post by: Thomas. 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???
Title: Blit for Textures?
Post by: EgonOlsen on March 28, 2011, 12:09:57 pm
RGB color values. You can set single pixels of the texture with that.
Title: Blit for Textures?
Post by: Thomas. 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;?
Title: Blit for Textures?
Post by: EgonOlsen 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.
Title: Blit for Textures?
Post by: Thomas. 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?
Title: Re: Blit for Textures?
Post by: EgonOlsen 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!?
Title: Re: Blit for Textures?
Post by: Thomas. 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...
Title: Re: Blit for Textures?
Post by: EgonOlsen 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.
Title: Re: Blit for Textures?
Post by: Thomas. 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...?
Title: Re: Blit for Textures?
Post by: Thomas. 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....
Title: Re: Blit for Textures?
Post by: EgonOlsen 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.