Hi,
I’m fairly new to OpenVG and am trying to learn some of the basics. Right now, I am attempting to display a 160x160 image in a 612x792 window using the OpenVG sample code that’s available from the Khronos site.
So far, I’ve had no luck in getting the image to be displayed. Could anyone give some pointers to what I could be doing wrong, or if I’m missing something?
Below is the code that is attempting to display the image:
vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
vgClear(0, 0, 612, 792);
// Acquire the source image
ptr_source_image = (unsigned short*)&WHITE[0];
// Create the VG image
vg_img = vgCreateImage(VG_sARGB_1555, 160, 160, VG_IMAGE_QUALITY_BETTER);
vgImageSubData(vg_img, ptr_source_image, 0, VG_sARGB_1555, 0, 0, 160, 160);
// Draw the image
vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
vgLoadIdentity();
vgTranslate(306.0f - (float)(160 / 2), 396.0f - (float)(160 / 2));
vgDrawImage(vg_img);
eglSwapBuffers(egldisplay, eglsurface); //vgFlush( ) is called in here
Note: The image source, WHITE[ ], is an array containing 16-bit color, in the format of 1 Alpha Bit/5 Red bits/5 Green bits/5 Blue bits.
Thanks!