mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
32 lines
718 B
C++
32 lines
718 B
C++
#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*)(intptr_t)tex;
|
|
}
|
|
|
|
void FreeTexture( void* _tex )
|
|
{
|
|
auto tex = (GLuint)(intptr_t)_tex;
|
|
glDeleteTextures( 1, &tex );
|
|
}
|
|
|
|
void UpdateTexture( void* _tex, const char* data, int w, int h )
|
|
{
|
|
auto tex = (GLuint)(intptr_t)_tex;
|
|
glBindTexture( GL_TEXTURE_2D, tex );
|
|
glCompressedTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB8_ETC2, w, h, 0, w * h / 2, data );
|
|
}
|
|
|
|
}
|