Hello folks,
Any there any problem with the following code:
void loadTextures()
{
glActiveTexture(GL_TEXTURE0);
int textureWidth = 0;
int textureHeight = 0;
int channels = 0;
GLubyte *texData = SOIL_load_image("images/brick1.tga",&textureWidth,
&textureHeight,
&channels,
SOIL_LOAD_AUTO);
if(texData == NULL)
{
std::cerr << "Error loading image: " << std::endl;
exit(EXIT_FAILURE);
}
glGenTextures(1,&cubeTextureID);
glBindTexture(GL_TEXTURE_2D,cubeTextureID);
glTexStorage2D(GL_TEXTURE_2D,1,GL_RGBA8,textureWidth,textureHeight);
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,textureWidth,textureHeight,GL_RGBA,GL_UNSIGNED_BYTE,BUFFER_OFFSET(texData));
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
//free the image data
SOIL_free_image_data(texData);
}
The application crashes at glTexSubImage2D(…) command. I recall that i had similar issues before and it was widely discussed in the forum and i have tried to retrieve those discussion and did not find it. Are forum contents are cleared after certain time old ?
Any way, can you point to the issue that is causing the crash and refer me some explanation once again please ?
Thanks