From 0c36bfba5d78b61e01b7c6540b07a0885a03e693 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 26 Jul 2022 01:49:19 +0200 Subject: [PATCH] Allow creating RGBA textures. --- server/TracyTexture.cpp | 7 +++++++ server/TracyTexture.hpp | 1 + 2 files changed, 8 insertions(+) diff --git a/server/TracyTexture.cpp b/server/TracyTexture.cpp index 8e4a9e63..8bc6f465 100644 --- a/server/TracyTexture.cpp +++ b/server/TracyTexture.cpp @@ -35,4 +35,11 @@ void UpdateTexture( void* _tex, const char* data, int w, int h ) glCompressedTexImage2D( GL_TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, w, h, 0, w * h / 2, data ); } +void UpdateTextureRGBA( void* _tex, void* data, int w, int h ) +{ + auto tex = (GLuint)(intptr_t)_tex; + glBindTexture( GL_TEXTURE_2D, tex ); + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data ); +} + } diff --git a/server/TracyTexture.hpp b/server/TracyTexture.hpp index 24cdab69..128834da 100644 --- a/server/TracyTexture.hpp +++ b/server/TracyTexture.hpp @@ -9,6 +9,7 @@ namespace tracy void* MakeTexture(); void FreeTexture( void* tex, void(*runOnMainThread)(std::function, bool) ); void UpdateTexture( void* tex, const char* data, int w, int h ); +void UpdateTextureRGBA( void* tex, void* data, int w, int h ); }