I created a pixmap using, for example, this code
//...
// Native Activity
#define HEIGHT 600
#define WIDTH 600
uint32_t texDat[WIDTH*HEIGHT*4];
static double it = 0;
uint8_t color = sin(it)*256;
for (int i = 0; i < WIDTH; i++) for (int j = 0; j < HEIGHT; j++)
texDat [ i + j*WIDTH ] = (i << 16) | (j << 8) | (color<< 0);
it+=0.01;
if(it >= M_PI) it = 0;
On my Linux pc this pixmap can be shown with glDrawPixels or with glTexImage2D. But I can't find glDrawPixels or something same on Android GLES. I tried to copy image to screen with this
ANativeWindow_Buffer pbuffer;
if (ANativeWindow_lock(engine->app->window, &pbuffer, NULL) == 0) {
memcpy(pbuffer.bits, texDat, WIDTH*HEIGHT);
ANativeWindow_unlockAndPost(engine->app->window);
}
But it fails even if copying size is set to 1. How can I upload pixmap to screen?
Thanks.
GLES shader-based solution. Based on Android test