title: Assimp no Textures
body: <p>I write a Modelloader with Assimp in C++. The problem is that the Textures of the Model not show in the Programm. I am Positive that the Model has Textures. 
  Here is the relevant Code:</p>
  
  <p>Vertex Shader:</p>
  
  <pre><code>#version 330
  
  in vec4 position;
  uniform mat4 matrix;
  
  layout(location = 1) in vec2 texCoords;
  
  out vec2 TexCoord;
  void main()
  {
  
  gl_Position=matrix*position;
  
  TexCoord = vec2(texCoords);
  }
  </code></pre>
  
  <p>Fragmet Shader:</p>
  
  <pre><code> #version 330
  
   out vec2 TexCoord;
   out vec3 color;
  
   uniform sampler2D tex;
  
   void main(){
   color = texture(tex, TexCoord).rgb;
   };
  </code></pre>
  
  <p>Mesh Class:</p>
  
  <pre><code>    if(scene-&gt;HasMaterials()){
  for(unsigned int i = 0; i &lt; scene-&gt;mNumMaterials; i++){
  
  
      const aiMaterial* material = scene-&gt;mMaterials[i];
      int texIndex = 0;
      GLint texture;
      aiString path;
  
  if(material-&gt;GetTexture(aiTextureType_DIFFUSE, texIndex, &amp;path)==AI_SUCCESS){
  
          std::string textureDir = path.data;
          std::string fullPath = directory + '\\' + textureDir;
  
          std::cout &lt;&lt; fullPath &lt;&lt; std::endl; 
  
  LoadTexture(fullPath,&amp;t);
  
      }
  }
  }
  </code></pre>
  
  <p>And the LoadTexture method:</p>
  
  <pre><code>GLint Mesh::MeshEntry::LoadTexture(std::string path, struct TextureHandle *T){
  
          ilInit();
          ilEnable(IL_ORIGIN_SET);
          ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
          ILuint ImageNameID;
          ilGenImages(1,&amp;ImageNameID);
          ilBindImage(ImageNameID);
          if(!ilLoadImage(path.c_str())){
              return 0;
          }
          ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
          T-&gt;id = ImageNameID;
          T-&gt;p = ilGetData();
          T-&gt;w = ilGetInteger(IL_IMAGE_WIDTH);
          T-&gt;h = ilGetInteger(IL_IMAGE_HEIGHT);
          T-&gt;DestFormat = ilGetInteger(IL_IMAGE_FORMAT);
          T-&gt;DestType = ilGetInteger(IL_IMAGE_TYPE);
  
          GLuint textureid;
  
          glGenTextures(1,&amp;textureid);
          glBindTexture(GL_TEXTURE_2D,textureid);
  
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
          glTexImage2D (GL_TEXTURE_2D, 0, t.DestFormat, t.w, t.h, 0, t.DestFormat, t.DestType, t.p);
          glGenerateMipmap(GL_TEXTURE_2D);
  
  
          GLint texloc = (glGetUniformLocation(ma.getProgrammID(),"tex"));
  
          glUniform1i(texloc,0); 
          glActiveTexture(GL_TEXTURE0);
          glBindTexture(GL_TEXTURE_2D,textureid);
          return 1;
  
  }
  </code></pre>
  
  <p>I know this code is not the best. So I need your help :).</p>