GlobeEngine
TextureHandle.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_TextureHandle_h
10 #define GlobeEngine_TextureHandle_h
11 
12 #include "OpenGL_Includes.h"
13 #include <iostream>
14 #include <memory>
15 
16 namespace ge {
17 
19  {
20  public:
35  // bindless texture states
36  enum BindlessState { NOHANDLE = 0,
41 
42  public:
43  TextureHandle();
44  /*TextureHandle(const std::shared_ptr<TextureHandle> copy){
45  this->target = copy->target;
46  this->handle = copy->handle;
47  this->bindlessHandle = copy->bindlessHandle;
48  this->bindlessState = copy->bindlessState;
49  }*/
50 
51  virtual ~TextureHandle();
52 
53  void clear();
54 
55  void createHandle(GLenum _target);
56  void createFromExistingHandle(GLenum _target, GLuint _handle);
57  void bind(GLint _unit = -1) const;
58  void unbind(GLint _unit = -1) const;
59 
60  static void bindTextureHandle2DToUnit(GLuint _handle, GLint _unit);
61  static void unbindTextureHandle2DToUnit(GLuint _handle,GLint _unit);
62 
63  GLenum getTarget() const;
64 
65  void overrideHandle(GLuint _handle);
66  GLuint getHandle() const;
67  void deleteHandle();
68 
69 #ifndef GENGINE_GL_BELOW_410
70  void bindTextureToShader(GLuint _shaderUnit, GLenum _internalFormat, GLenum _access = GL_READ_WRITE, GLint _texlevel = 0, GLboolean _islayered = GL_FALSE, GLint _texlayer = 0);
71 
72  // bindless texture functions
73  GLuint64 getBindlessHandle() const;
75  void setBindlessHandle();
76  void makeTextureResident();
78 
79 #endif
80  protected:
81  void getOpenGLError(std::string _input);
82 
83  GLenum target;
84  GLuint handle;
85 
86  // bindless texture properties
87  GLuint64 bindlessHandle;
89  };
90 }
91 #endif
Definition: TextureHandle.h:21
Definition: TextureHandle.h:34
void overrideHandle(GLuint _handle)
Definition: TextureHandle.cpp:61
Definition: TextureHandle.h:25
Definition: TextureHandle.h:27
void setBindlessHandle()
Definition: TextureHandle.cpp:107
void deleteHandle()
Definition: TextureHandle.cpp:31
Definition: TextureHandle.h:33
Definition: TextureHandle.h:40
TextureHandle()
Definition: TextureHandle.cpp:12
Definition: TextureHandle.h:32
GLenum target
Definition: TextureHandle.h:83
Definition: TextureHandle.h:40
static void unbindTextureHandle2DToUnit(GLuint _handle, GLint _unit)
Definition: TextureHandle.cpp:91
Definition: TextureHandle.h:30
static void bindTextureHandle2DToUnit(GLuint _handle, GLint _unit)
Definition: TextureHandle.cpp:84
GLuint64 getBindlessHandle() const
Definition: TextureHandle.cpp:103
void createHandle(GLenum _target)
Definition: TextureHandle.cpp:43
BindlessState getBindlessState() const
Definition: TextureHandle.cpp:114
Definition: TextureHandle.h:39
void bind(GLint _unit=-1) const
Definition: TextureHandle.cpp:65
Definition: TextureHandle.h:26
void clear()
Definition: TextureHandle.cpp:23
Definition: TextureHandle.h:22
void makeTextureResident()
Definition: TextureHandle.cpp:118
BindlessState
Definition: TextureHandle.h:36
Definition: TextureHandle.h:38
BindlessState bindlessState
Definition: TextureHandle.h:88
Definition: TextureHandle.h:29
Definition: AvalancheTrainingSimulationEngine.h:28
Definition: TextureHandle.h:24
void makeTextureNonResident()
Definition: TextureHandle.cpp:126
Definition: TextureHandle.h:31
GLenum getTarget() const
Definition: TextureHandle.cpp:134
void getOpenGLError(std::string _input)
Definition: TextureHandle.cpp:137
virtual ~TextureHandle()
Definition: TextureHandle.cpp:19
eTEXTURE_TYPES
Definition: TextureHandle.h:21
Definition: TextureHandle.h:37
GLuint handle
Definition: TextureHandle.h:84
GLuint getHandle() const
Definition: TextureHandle.cpp:135
void bindTextureToShader(GLuint _shaderUnit, GLenum _internalFormat, GLenum _access=GL_READ_WRITE, GLint _texlevel=0, GLboolean _islayered=GL_FALSE, GLint _texlayer=0)
Definition: TextureHandle.cpp:99
Definition: TextureHandle.h:23
GLuint64 bindlessHandle
Definition: TextureHandle.h:87
void createFromExistingHandle(GLenum _target, GLuint _handle)
Definition: TextureHandle.cpp:52
void unbind(GLint _unit=-1) const
Definition: TextureHandle.cpp:77
Definition: TextureHandle.h:18
Definition: TextureHandle.h:36
Definition: TextureHandle.h:28