Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2019-06-06 23:07:56 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2019-06-06 23:14:51 +0300
commit82d4fe7236a9a8129bb388e50b5225004508868c (patch)
tree77c45eb5de06b638930647889a4a4a8a0da4fcc3 /server/TracyTexture.cpp
parentaf56f41e3224e7df54afaa516946d518b695c7a2 (diff)
Add texture wrapper.
Diffstat (limited to 'server/TracyTexture.cpp')
-rw-r--r--server/TracyTexture.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/TracyTexture.cpp b/server/TracyTexture.cpp
new file mode 100644
index 00000000..9743381b
--- /dev/null
+++ b/server/TracyTexture.cpp
@@ -0,0 +1,31 @@
+#include <gl/gl3w.h>
+
+#include "TracyTexture.hpp"
+
+namespace tracy
+{
+
+void* MakeTexture()
+{
+ GLuint tex;
+ glGenTextures( 1, &tex );
+ glBindTexture( GL_TEXTURE_2D, tex );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ return (void*)tex;
+}
+
+void FreeTexture( void* _tex )
+{
+ auto tex = (GLuint)_tex;
+ glDeleteTextures( 1, &tex );
+}
+
+void UpdateTexture( void* _tex, const char* data, int w, int h )
+{
+ auto tex = (GLuint)_tex;
+ glBindTexture( GL_TEXTURE_2D, tex );
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
+}
+
+}