Caffe2 - C++ API
A deep learning, cross platform ML framework
GLPlainTexture.h
1 
2 #pragma once
3 
4 #include "GLContext.h"
5 #include "GLTexture.h"
6 
7 class GLPlainTexture : public GLTexture {
8  private:
9  bool isOwner = true;
10 
11  public:
12  GLPlainTexture(const Type& type,
13  const void* input,
14  GLsizei width,
15  GLsizei height,
16  bool use_padding = false,
17  GLint filter = GL_NEAREST,
18  GLint wrap = GL_CLAMP_TO_EDGE);
19 
20  GLPlainTexture(const Type& type,
21  const GLuint textureID,
22  GLsizei width,
23  GLsizei height,
24  bool use_padding = false,
25  GLint filter = GL_NEAREST,
26  GLint wrap = GL_CLAMP_TO_EDGE);
27 
28  ~GLPlainTexture() {
29  if (glIsTexture(_textureId)) {
30  if (isOwner) {
31  gl_log(GL_VERBOSE, "~GLPlainTexture() - deleting texture %d\n", _textureId);
32  glDeleteTextures(1, &_textureId);
33  }
34  } else {
35  gl_log(GL_ERR, "not deleting texture %d\n", _textureId);
36  }
37  }
38 
39  GLuint name() const { return _textureId; };
40 
41  GLenum target() const { return GL_TEXTURE_2D; };
42 
43  bool flipped() const { return false; };
44 };