Where to put blit(...)?

Started by AGP, June 11, 2015, 06:43:33 PM

Previous topic - Next topic

AGP

The docs make reference to a non-existent buffer.update(). Where do I put it in Android? Just after clear()?

EgonOlsen

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.

AGP

OK, thank you. Would you mind fixing the docs?

EgonOlsen

Yes, I'll remove that reference to update from the AE-docs. I wasn't aware of it.

AGP

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)?

AGP

To answer my own question, I just used the int[] blit instead:


                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);

EgonOlsen

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...!?