- u8 *tex_buffer = qoi_decode( src_data, length, &info, 4 );
-
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, info.width, info.height,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_buffer );
-
- free( tex_buffer );
- free( src_data );
- }
- else
- {
+ u8 *tex_buffer = qoi_decode( file, size, &info, 4 );
+
+ if( tex_buffer )
+ {
+ vg_info( "Texture decoded: [%u %u] %s\n",
+ info.width, info.height, path );
+
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, info.width, info.height,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_buffer );
+
+ /* TODO: pass through linear_alloc function */
+ QOI_FREE(tex_buffer);
+ }
+ else
+ {
+ vg_error( "File size: %u\n", size );
+ goto temp_error;
+ }
+ }
+ else
+ {
+temp_error:
+ vg_error( "Loading texture failed (%s)\n", path );
+