Original Post
void Building::_renderDefaultBuilding()const{
glColor3f(1.0f,1.0f,1.0f);
glTranslatef(m_position.x,m_position.y,m_position.z);
Vector3f t = m_size / 2.0f;
glTranslatef(t.x,t.y,-t.z); //translate so its bottom surface starts at (0,0,0)
glScalef(m_size.x,m_size.y,m_size.z);
if(!Resource::textureList.empty()){
glBindTexture(GL_TEXTURE_2D, Resource::textureList[Resource::NIGHT_BUILDING_TEXTURE]);
float s[] = {0.01f,0.0f,0.0f,0.0f};
float t[] = {0.0f,0.01f,0.0f,0.0f};
glTexGenfv(GL_S, GL_OBJECT_LINEAR, s);
glTexGenfv(GL_T, GL_OBJECT_LINEAR, t);
glEnable(GL_TEXTURE_GEN_S); // Auto Texture Generation
glEnable(GL_TEXTURE_GEN_T);
}
glutSolidCube(1.0f);
glScalef(1.0f/m_size.x,1.0f/m_size.y,1.0f/m_size.z);
glTranslatef(-t.x,-t.y,t.z);
glTranslatef(-m_position.x, -m_position.y, -m_position.z);
}
so I have the above code, but I need help with auto generating the textures such that I can scale which part of the texture gets rendered. Any help on this?