summaryrefslogtreecommitdiff
path: root/tests/font/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/font/main.c')
-rw-r--r--tests/font/main.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/font/main.c b/tests/font/main.c
index d65cc09..10abf9a 100644
--- a/tests/font/main.c
+++ b/tests/font/main.c
@@ -476,6 +476,39 @@ GLuint CreateSimpleTexture2D( )
}
+GLuint CreateVGTexture2D(ESContext *esContext)
+{
+ // Texture object handle
+ GLuint textureId;
+
+ // 2x2 Image, 3 bytes per pixel (R, G, B)
+ // Use tightly packed data
+ glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
+
+ // Generate a texture object
+ glGenTextures ( 1, &textureId );
+
+ // Bind the texture object
+ glBindTexture ( GL_TEXTURE_2D, textureId );
+
+ // Load the texture
+ glTexImage2D ( GL_TEXTURE_2D, 0, GL_RGB, esContext->width, esContext->height, 0, GL_RGB, GL_UNSIGNED_BYTE, tgTextureBuffer);
+
+ // Set the filtering mode
+ glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+
+ return textureId;
+
+}
+
+void Update(ESContext *esContext, float deltaTime) {
+ UserData *userData = esContext ->userData;
+
+ glDeleteTextures ( 1, &userData->textureId );
+ userData->textureId = CreateVGTexture2D (esContext);
+}
+
///
// Initialize the shader and program object
//
@@ -597,6 +630,7 @@ int main ( int argc, char *argv[] )
initFont();
esRegisterDrawFunc ( &esContext, Draw );
+ esRegisterUpdateFunc ( &esContext, Update);
esMainLoop ( &esContext );