A
A
Alexander Shustanov2016-09-06 11:24:42
Android
Alexander Shustanov, 2016-09-06 11:24:42

How to shift the previous frame to the left by some amount in gles 2.0?

Good afternoon. There is a task to draw on the android in runtime a graph of changes in a certain value coming via bluetooth. The graph is not entirely trivial, drawing on a regular canvas will not work, but gles is needed. This is due to the fact that each value of the quantity of interest is not just an ordinary value, but a set of different values ​​+ different interesting gradients.
The idea is this - when a new value arrives at the right edge of the screen, a column is drawn with gles, 1/200 of the screen width. In this case, the frame drawn last time must be shifted to the left by the width of the column.
I implemented it in the following way. Graph columns are rendered not on GlSurfaceView, but on a bitmap. Before that, with the help of the canvas, the bitmap is drawn on top of itself with an offset to the width of the column.
I would like to get rid of the magic with canvases and bitmaps, and make it on pure gles.
If it's quite simple, then the task is to draw an arbitrary piece of the past frame on top of itself, in an arbitrary place on the screen.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-09-06
@alexander-shustanov

I think we need to render the frame to a texture, then draw it. You will need two screen-sized textures. This can be done on pure gl. Here I have an example in C ++, shit code, I'm ashamed of it, but you can see the idea, in my opinion.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question