From b00fa0278f025739f276d010a2fe3a793ba66d21 Mon Sep 17 00:00:00 2001 From: Tom Gall Date: Wed, 8 Oct 2014 11:25:47 -0500 Subject: Add fix from Show to correctly interpret order of color values from the OpenVG buffers. (And crazy order at that!) --- tests/font/main.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/font/main.c b/tests/font/main.c index 992bbeb..37ed89e 100644 --- a/tests/font/main.c +++ b/tests/font/main.c @@ -77,6 +77,7 @@ #define WINDOW_H 768 unsigned char tgTextureBuffer [1024 * 768 * 4]; +int needRefresh; static STATE_T _state, *state = &_state; // global graphics state static const int MAXFONTPATH = 256; @@ -480,8 +481,9 @@ GLuint CreateVGTexture2D(ESContext *esContext) { // Texture object handle GLuint textureId; + int i,j; + unsigned char tmp; - // 2x2 Image, 3 bytes per pixel (R, G, B) // Use tightly packed data glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 ); @@ -550,19 +552,29 @@ int Init ( ESContext *esContext ) userData->time = 1.0f; glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ); + + needRefresh = 0 ; return GL_TRUE; } void Draw ( ESContext *esContext ) { UserData *userData = esContext->userData; - GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0 + /*GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0 0.0f, 0.0f, // TexCoord 0 -0.5f, -0.5f, 0.0f, // Position 1 0.0f, 1.0f, // TexCoord 1 0.5f, -0.5f, 0.0f, // Position 2 1.0f, 1.0f, // TexCoord 2 0.5f, 0.5f, 0.0f, // Position 3 + 1.0f, 0.0f // TexCoord 3 */ + GLfloat vVertices[] = { -1.0f, -1.0f, 0.0f, // Position 0 + 0.0f, 0.0f, // TexCoord 0 + -1.0f, 1.0f, 0.0f, // Position 1 + 0.0f, 1.0f, // TexCoord 1 + 1.0f, 1.0f, 0.0f, // Position 2 + 1.0f, 1.0f, // TexCoord 2 + 1.0f, -1.0f, 0.0f, // Position 3 1.0f, 0.0f // TexCoord 3 }; GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; @@ -571,8 +583,9 @@ void Draw ( ESContext *esContext ) Start(esContext->width, esContext->height); // Start the picture - Background(esContext, 5, 5, 5); // Black background + Background(esContext,0, 0, 0); // Black background Fill(44, 77, 232, 1.0); // Big blue marble +// Fill(232, 77, 44, 1.0); // Big blue marble Circle((VGfloat) (esContext->width / 2), 0.0, (VGfloat)esContext->width); // The "world" Fill(255, 255, 255, 1.0); // White text TextMid((VGfloat)(esContext->width / 2),(VGfloat) ( esContext->height / 2),(char *) &text, SerifTypeface, esContext->width/10); // Greetings @@ -580,7 +593,8 @@ void Draw ( ESContext *esContext ) // f = VG_sARGB_8888; - f = VG_sRGBA_8888; +// f = VG_sRGBA_8888; + f = VG_sABGR_8888; vgReadPixels(tgTextureBuffer, esContext->width*sizeof(unsigned int), f, 0, 0, esContext->width, esContext->height); @@ -612,6 +626,7 @@ void Draw ( ESContext *esContext ) glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices ); + } int main ( int argc, char *argv[] ) -- cgit v1.2.3