Demos update
-added functionality to detect host CPU threads count -fixed some memory leaks -now textures free memory corectly -added support for up to 32 threads
This commit is contained in:
parent
dd491302af
commit
3647fa4b86
6 changed files with 98 additions and 16 deletions
|
|
@ -54,6 +54,8 @@ struct Texture
|
|||
data.data = Mallocator.makeArray!ubyte(surf.w*surf.h*surf.format.BytesPerPixel);
|
||||
data.data[0..$] = (cast(ubyte*)surf.pixels)[0..data.data.length];
|
||||
|
||||
SDL_FreeSurface(surf);
|
||||
|
||||
glGenTextures(1, &data.gl_handle);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D,data.gl_handle);
|
||||
|
|
@ -78,11 +80,12 @@ struct Texture
|
|||
glBindTexture(GL_TEXTURE_2D, data.gl_handle);
|
||||
}
|
||||
|
||||
void destory()
|
||||
void destory() @nogc nothrow
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
glDeleteTextures(1, &data.gl_handle);
|
||||
if(data.data)Mallocator.dispose(data.data);
|
||||
Mallocator.dispose(data);
|
||||
data = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue