How do I create an array of GLTexture nullptrs with a size calculated at runtime? . The implementation below creates an array GLTexture pointers initialised with nullptr with a constant size of [11][32]. I want the 11 and 32 shown in the header file below to be interchanged with a value calculated at runtime.
Header File
#pragma once
#include <GLEW\glew.h>
#include "GLTexture.h"
namespace Nova
{
class TextureBinder
{
private:
GLuint m_activeUnit;
GLint m_maxTextureUnits;
GLint m_maxTextureTargets;
GLTexture* m_boundTextures[11][32] = {nullptr};
public:
static TextureBinder& GetInstance()
{
static TextureBinder binder;
return binder;
}
TextureBinder(TextureBinder const&) = delete;
void operator=(TextureBinder&) = delete;
private:
TextureBinder();
};
}
CPP File
#pragma once
#include "TextureBinder.h"
namespace Nova
{
/* zero is the default opengl active texture unit
- glActiveTexture(unit) only needs to be called for multitexturing
*/
TextureBinder::TextureBinder()
:
m_activeUnit(0),
m_maxTextureTargets(11)
{
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &m_maxTextureUnits);
}
}
m_boundTexturespointers pointing to textures that this class owns, or are they managed elsewhere?