-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deletors.h
52 lines (51 loc) · 897 Bytes
/
Deletors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <GL\glew.h>
#pragma once
struct deleteGLBuffer //needs Size
{
deleteGLBuffer() {}
void operator()(GLuint* buf) const
{
if (glIsBuffer(buf[0]))
glDeleteBuffers(int(sizeof(buf) / sizeof(GLuint)), buf);
}
};
struct deleteGLVAO
{
deleteGLVAO() {}
void operator()(GLuint* buf) const
{
if (glIsBuffer(buf[0]))
glDeleteBuffers(int(sizeof(buf) / sizeof(GLuint)), buf);
}
};
struct deleteGLShader
{
deleteGLShader() {}
void operator()(GLuint* s) const
{
if (s == nullptr)
return;
else if (*s != -1)
if (glIsShader(*s))
glDeleteShader(*s);
delete s;
}
};
struct deleteGLProgram
{
deleteGLProgram() {}
void operator()(GLuint* prgm) const
{
if (glIsProgram(*prgm))
glDeleteProgram(*prgm);
}
};
struct deleteGLTexture //needs Size
{
deleteGLTexture() {}
void operator()(GLuint* tex) const
{
if (glIsTexture(*tex))
glDeleteTextures(1, tex);
}
};