www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: AGP on June 11, 2015, 06:43:33 pm

Title: Where to put blit(...)?
Post by: AGP on June 11, 2015, 06:43:33 pm
The docs make reference to a non-existent buffer.update(). Where do I put it in Android? Just after clear()?
Title: Re: Where to put blit(...)?
Post by: EgonOlsen on June 11, 2015, 06:46:58 pm
Where you want/have to. blit() draws over the current content of the framebuffer. Usually, you want to put it after draw to render some GUI elements but there might the situations where you want to put before the 3d rendering as well.
Title: Re: Where to put blit(...)?
Post by: AGP on June 11, 2015, 06:48:44 pm
OK, thank you. Would you mind fixing the docs?
Title: Re: Where to put blit(...)?
Post by: EgonOlsen on June 11, 2015, 06:51:12 pm
Yes, I'll remove that reference to update from the AE-docs. I wasn't aware of it.
Title: Re: Where to put blit(...)?
Post by: AGP on June 12, 2015, 03:08:58 am
Thanks.

Now, I have to keep updating a texture with which to blit the FrameBuffer. How could I go about updating its data without constantlly recreating it (I'm drawing onto a single Bitmap and would like to update the texture to the Bitmap without destroying and recreating it)?
Title: Re: Where to put blit(...)?
Post by: AGP on June 12, 2015, 05:01:26 am
To answer my own question, I just used the int[] blit instead:

Code: [Select]
                int i = 0;
                for (int y = 0; y < textMap.getHeight(); y++)
                    for (int x = 0; x < textMap.getWidth(); x++)
                        array[i++] = textMap.getPixel(x, y);
                 buffer.blit(array, textMap.getWidth(), textMap.getHeight(), 0, 0, 80, 100, textMap.getWidth(), textMap.getHeight(), false);
Title: Re: Where to put blit(...)?
Post by: EgonOlsen on June 12, 2015, 07:56:23 am
This still triggers a new texture upload for each blit, which might become a performance problem. What are you doing exactly with the texture's content? Maybe there's a faster way of doing it...!?