mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Add texture wrapper.
This commit is contained in:
parent
af56f41e32
commit
82d4fe7236
@ -114,6 +114,7 @@
|
|||||||
<ClCompile Include="..\..\..\server\TracyBadVersion.cpp" />
|
<ClCompile Include="..\..\..\server\TracyBadVersion.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
|
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyStorage.cpp" />
|
<ClCompile Include="..\..\..\server\TracyStorage.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\server\TracyTexture.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyView.cpp" />
|
<ClCompile Include="..\..\..\server\TracyView.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyWorker.cpp" />
|
<ClCompile Include="..\..\..\server\TracyWorker.cpp" />
|
||||||
<ClCompile Include="..\..\libs\gl3w\GL\gl3w.c" />
|
<ClCompile Include="..\..\libs\gl3w\GL\gl3w.c" />
|
||||||
@ -165,6 +166,7 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracySlab.hpp" />
|
<ClInclude Include="..\..\..\server\TracySlab.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyStorage.hpp" />
|
<ClInclude Include="..\..\..\server\TracyStorage.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyStringDiscovery.hpp" />
|
<ClInclude Include="..\..\..\server\TracyStringDiscovery.hpp" />
|
||||||
|
<ClInclude Include="..\..\..\server\TracyTexture.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyVarArray.hpp" />
|
<ClInclude Include="..\..\..\server\TracyVarArray.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyVector.hpp" />
|
<ClInclude Include="..\..\..\server\TracyVector.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyVersion.hpp" />
|
<ClInclude Include="..\..\..\server\TracyVersion.hpp" />
|
||||||
|
@ -93,6 +93,9 @@
|
|||||||
<ClCompile Include="..\..\..\imgui\imgui_widgets.cpp">
|
<ClCompile Include="..\..\..\imgui\imgui_widgets.cpp">
|
||||||
<Filter>imgui</Filter>
|
<Filter>imgui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\server\TracyTexture.cpp">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
|
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
|
||||||
@ -257,6 +260,9 @@
|
|||||||
<ClInclude Include="..\..\src\stb_image.h">
|
<ClInclude Include="..\..\src\stb_image.h">
|
||||||
<Filter>src</Filter>
|
<Filter>src</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\server\TracyTexture.hpp">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="DebugVis.natvis" />
|
<Natvis Include="DebugVis.natvis" />
|
||||||
|
31
server/TracyTexture.cpp
Normal file
31
server/TracyTexture.cpp
Normal file
@ -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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
server/TracyTexture.hpp
Normal file
13
server/TracyTexture.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef __TRACYTEXTURE_HPP__
|
||||||
|
#define __TRACYTEXTURE_HPP__
|
||||||
|
|
||||||
|
namespace tracy
|
||||||
|
{
|
||||||
|
|
||||||
|
void* MakeTexture();
|
||||||
|
void FreeTexture( void* tex );
|
||||||
|
void UpdateTexture( void* tex, const char* data, int w, int h );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user