17 constexpr static GLuint NO_BUF = 0;
21 GlBuffer(
GlBuffer && r ) : bufferID_( r.bufferID_ ), size_( r.size_ ) { r.detach_(); }
27 auto getId()
const {
return bufferID_; }
28 bool valid()
const {
return bufferID_ != NO_BUF; }
29 size_t size()
const {
return size_; }
32 MRVIEWER_API
void gen();
35 MRVIEWER_API
void del();
38 MRVIEWER_API
void bind( GLenum target );
41 MRVIEWER_API
void loadData( GLenum target,
const char * arr,
size_t arrSize );
43 void loadData( GLenum target,
const T * arr,
size_t arrSize ) {
loadData( target, (
const char *)arr,
sizeof( T ) * arrSize ); }
45 void loadData( GLenum target,
const C & cont ) {
loadData( target, cont.data(), cont.size() ); }
48 MRVIEWER_API
void loadDataOpt( GLenum target,
bool refresh,
const char * arr,
size_t arrSize );
50 void loadDataOpt( GLenum target,
bool refresh,
const T * arr,
size_t arrSize ) {
loadDataOpt( target, refresh, (
const char *)arr,
sizeof( T ) * arrSize ); }
52 void loadDataOpt( GLenum target,
bool refresh,
const C & cont ) {
loadDataOpt( target, refresh, cont.data(), cont.size() ); }
56 void detach_() { bufferID_ = NO_BUF; size_ = 0; }
59 GLuint bufferID_ = NO_BUF;
71 return Vector3i( value.x, value.y, 1 );
74 MRVIEWER_API
virtual void texImage_(
const Settings& settings,
const char* arr )
override;
83 MRVIEWER_API
virtual void texImage_(
const Settings& settings,
const char* arr )
override;
92 MRVIEWER_API
virtual void texImage_(
const Settings& settings,
const char* arr )
override;
98 const char *
name =
nullptr;
100 const char *
arr =
nullptr;
110template<
typename T,
template<
typename,
typename...>
class C,
typename... args>
112 const GLuint program_shader,
115 const C<T, args...>& V,
116 int baseTypeElementsNumber,
118 bool forceUse =
false )
125 .arr = (
const char*)V.data(),
126 .arrSize =
sizeof(T) * V.
size(),
127 .baseTypeElementsNumber = baseTypeElementsNumber,
129 .forceUse = forceUse,
130 .isColor = std::is_same_v<Color, T>
135template <
typename T, std::
size_t N>
137 const GLuint program_shader,
140 const std::array<T, N>& V,
141 int baseTypeElementsNumber,
143 bool forceUse =
false )
150 .arr = (
const char*)V.data(),
151 .arrSize =
sizeof(T) * N,
152 .baseTypeElementsNumber = baseTypeElementsNumber,
154 .forceUse = forceUse,
155 .isColor = std::is_same_v<Color, T>
204 MRVIEWER_API
void gen(
const Vector2i& size,
int msaaPow );
207 MRVIEWER_API
void bind(
bool clear =
true );
222 const Vector2i&
getSize()
const {
return size_; }
224 void resize_(
const Vector2i& size,
int msaaPow );
226 unsigned mainFramebuffer_{ 0 };
227 unsigned colorRenderbuffer_{ 0 };
228 unsigned depthRenderbuffer_{ 0 };
229 unsigned copyFramebuffer_{ 0 };
230 GlTexture2 resTexture_;
Definition MRRenderGLHelpers.h:199
MRVIEWER_API void gen(const Vector2i &size, int msaaPow)
MRVIEWER_API void bindDefault()
MRVIEWER_API void copyTextureBindDef()
const Vector2i & getSize() const
Definition MRRenderGLHelpers.h:222
MRVIEWER_API void bind(bool clear=true)
unsigned getTexture() const
Definition MRRenderGLHelpers.h:220
MRVIEWER_API void bindTexture()
Definition MRRenderGLHelpers.h:16
MRVIEWER_API void loadData(GLenum target, const char *arr, size_t arrSize)
void loadData(GLenum target, const T *arr, size_t arrSize)
Definition MRRenderGLHelpers.h:43
void loadData(GLenum target, const C &cont)
Definition MRRenderGLHelpers.h:45
GlBuffer(GlBuffer &&r)
Definition MRRenderGLHelpers.h:21
auto getId() const
Definition MRRenderGLHelpers.h:27
void loadDataOpt(GLenum target, bool refresh, const C &cont)
Definition MRRenderGLHelpers.h:52
GlBuffer & operator=(const GlBuffer &)=delete
~GlBuffer()
Definition MRRenderGLHelpers.h:22
GlBuffer(const GlBuffer &)=delete
void loadDataOpt(GLenum target, bool refresh, const T *arr, size_t arrSize)
Definition MRRenderGLHelpers.h:50
size_t size() const
Definition MRRenderGLHelpers.h:29
MRVIEWER_API void loadDataOpt(GLenum target, bool refresh, const char *arr, size_t arrSize)
MRVIEWER_API void bind(GLenum target)
bool valid() const
Definition MRRenderGLHelpers.h:28
Definition MRRenderGLHelpers.h:88
GlTexture2DArray()
Definition MRRenderGLHelpers.h:90
Definition MRRenderGLHelpers.h:65
GlTexture2()
Definition MRRenderGLHelpers.h:67
static Vector3i ToResolution(const Vector2i &value)
Definition MRRenderGLHelpers.h:69
Definition MRRenderGLHelpers.h:79
GlTexture3()
Definition MRRenderGLHelpers.h:81
Definition MRGLTexture.h:17
Definition MRRenderGLHelpers.h:236
Definition MRCameraOrientationPlugin.h:8
MRVIEWER_API GLint bindVertexAttribArray(const BindVertexAttribArraySettings &settings)
int getDepthFunctionLEqual(DepthFunction funcType)
Definition MRRenderGLHelpers.h:190
DepthFunction
Definition MRIRenderObject.h:18
int getDepthFunctionLess(DepthFunction funcType)
Definition MRRenderGLHelpers.h:162
Definition MRRenderGLHelpers.h:96
const char * arr
Definition MRRenderGLHelpers.h:100
GlBuffer & buf
Definition MRRenderGLHelpers.h:99
const char * name
Definition MRRenderGLHelpers.h:98
size_t arrSize
Definition MRRenderGLHelpers.h:101
int baseTypeElementsNumber
Definition MRRenderGLHelpers.h:102
GLuint program_shader
Definition MRRenderGLHelpers.h:97
bool refresh
Definition MRRenderGLHelpers.h:103
bool isColor
Definition MRRenderGLHelpers.h:105
bool forceUse
Definition MRRenderGLHelpers.h:104