X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_tex.h;h=e97900fed12054673ab7d5a67abe3d85661ecfa4;hb=d15415d2cd176f0bc8e4cb794c013c61b0f8d62f;hp=967337a8fa1a1e40cdbf3296a1347d08e445094c;hpb=5f7656147f3566b32e4eb8c5dffd554e233bdefb;p=fishladder.git diff --git a/vg/vg_tex.h b/vg/vg_tex.h index 967337a..e97900f 100644 --- a/vg/vg_tex.h +++ b/vg/vg_tex.h @@ -55,9 +55,6 @@ static inline void vg_tex2d_clamp(void) static GLuint vg_tex2d_rgba( const char *path ) { - int x,y,nc; - stbi_set_flip_vertically_on_load( 1 ); - i64 length; u8 *src_data = vg_asset_read_s( path, &length ); @@ -67,8 +64,10 @@ static GLuint vg_tex2d_rgba( const char *path ) if( src_data ) { - u8 *tex_buffer = stbi_load_from_memory( src_data, length, &x, &y, &nc, 4 ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_buffer ); + qoi_desc info; + 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 );