/* Sky Box */
fileNames.push_back("Textures/skybox/lostatseanight_front.jpg");
fileNames.push_back("Textures/skybox/lostatseanight_back.jpg");
fileNames.push_back("Textures/skybox/lostatseanight_left.jpg");
fileNames.push_back("Textures/skybox/lostatseanight_right.jpg");
fileNames.push_back("Textures/skybox/lostatseanight_top.jpg");
fileNames.push_back("Textures/skybox/lostatseanight_bottom.jpg");
//Using SOIL to load textures in my program
for (int i = 0; i < 6; i++)
{
skyBox[i] = SOIL_load_OGL_texture
(
fileNames[i].c_str(),
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y
);
if(skyBox[i] == 0)
returnfalse;
// Typical Texture Generation Using Data From The Bitmap
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
}
fileNames.clear();
The access violation happens when clear is called, and unfortunately I simply have no clew why.. I have used vectors for a long time and this has never happened before.
It seems that theres an issue with me using vectors in my project altogether.
I got rid of all the code you see above, no pushing data no clearing.. the only thing left was the vector<string> fileNames; in my class header, when the program exits I still get the access violation.
Problem solved, it was a silly typo in my skyBox[] variable.
I had;
1 2
GLuint skyBox[5];
vector<string> fileNames;
The skybox was supposed to be [6].
The for loop iterated 6 times, therefore writing data outside the bounds of the skybox[] array, which sequentially lead to writing that data into my vector.
Thanks for the tips btw, i've never heared of these debugging tools and features, they look very interesting!