I'm trying to create a textureLoader class for my openGL project and I can't initialize an array of textures inside of my class constructor because the the array won't accept anything unless it's a const int.
To paint you a simple picture...
myFunction(NUM)
{
GLuint textures[NUM];
}
My past Failures
myConstructor(const int& num)
{
GLuint textures[num] //error: expression must have a constant value
}
myConstructor(int num)
{
std::vector <GLuint> textures(num);//works but wait
glGenTextures(num, textures) // <--- doesn't work cause vectors.
}
myConstructor(int num)
{
const int PLEASE_WORK = num;
GLuint textures[PLEASE_WORK]; // doesn't work.
vectormethod) is called Variable-length arrays, which is supported in C99 but not in C++ IIRC.