I am wondering whether its possible to automatically generate texture coordinates for custom obj models to work with cubemaps. Every tutorial I see online is about environment mapping. Is it possible to write a shader that allows me to generate UV's like in this image: https://i.sstatic.net/3jID5.jpg
So far I've loaded cubemap texture:
bool Texture::LoadCubicTexture(vector<string> filenameTable)
{
glGenTextures(1,&texID);
glBindTexture(GL_TEXTURE_CUBE_MAP,texID);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_R,GL_CLAMP_TO_EDGE);
int i = 0;
vector<string>::iterator vsit;
// There is always six filenames
for(vsit=filenameTable.begin();vsit!=filenameTable.end();++vsit)
{
string filename = *vsit;
BMPData* bmpData = LoadTextureBMPData_custom(filename);
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X+i,0,GL_RGB,bmpData->width,bmpData->height,0,GL_BGR,GL_UNSIGNED_BYTE,&(bmpData->data[0]));
i++;
delete daneObrazu;
}
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
return true;
}
I've also have my custom .obj posted online here: https://pastebin.com/NVKgrGGZ