1
\$\begingroup\$

I've got .obj model with .mtl materials.I load like this: When I get aiTextureType_DIFFUSE I create new texture object and then call glGenTextures, glBindTexture and etc.

for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
    const aiMaterial* pMaterial = pScene->mMaterials[i];

    m_Textures[i] = NULL;
    if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
        aiString Path;

        if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
            m_Textures[i] = new Texture();
            if (!LoadTGA(m_Textures[i], const_cast<char*>(FullPath.c_str())))
            {
               ....
            }
            else {
        glGenTextures(1, &m_Textures[i]->texID);
        glBindTexture(GL_TEXTURE_2D, m_Textures[i]->texID);
        ....

How to load texture with diffuse, specular, ambient, shininess properties when they are all together in material file?

\$\endgroup\$
  • \$\begingroup\$ What actual problem are you running into? You're basically asking for a tutorial as your question is written now. \$\endgroup\$ – Sean Middleditch Dec 9 '13 at 19:32
  • \$\begingroup\$ well basically I require a tutorial I suppose. I want an example how to load texture with different kinds of properties. \$\endgroup\$ – lapots Dec 9 '13 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.