title: GLSL(1.2) + VBOs + Textures
body: <p>Again applying their considerable help with a problem. This is my code: </p>
  
  <pre><code>  float ctex[] = {0.0,0.0,
                    0.0,1.0,
                    1.0,1.0,
                    1.0,0.0};
  
    float data[] = {1.0, 1.0,-5.0,
                   -1.0,-1.0,-5.0,
                    1.0,-1.0,-5.0,
                   -1.0, 1.0,-5.0};
    GLuint ind[] = {0,1,2,0,3,1};     
  
        LoadTexture();  
  
        glGenBuffers(1,&amp;triangleVBO);
        glBindBuffer(GL_ARRAY_BUFFER,triangleVBO);
        glBufferData(GL_ARRAY_BUFFER,sizeof(data),data,GL_STATIC_DRAW);
  
        glGenBuffers(1,&amp;triangleIND);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,triangleIND);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(ind),ind,GL_STATIC_DRAW);
        glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,0,0);
  
        glGenBuffers(1,&amp;triangleT[0]);
        glBindBuffer(GL_ARRAY_BUFFER,triangleT[0]);
        glBufferData(GL_ARRAY_BUFFER,sizeof(ctex),ctex,GL_STATIC_DRAW);
        glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,0,0);
  
        GLuint v,f,p;
        v = glCreateShader(GL_VERTEX_SHADER);
        f = glCreateShader(GL_FRAGMENT_SHADER);
        p = glCreateProgram();
  
        char *vsFuente = LeeShader("shaders/shader.vert");
        char *fsFuente = LeeShader("shaders/shader.frag");
  
        const char *vs = vsFuente;
        const char *fs = fsFuente;
  
        glShaderSource(v,1,&amp;vs,NULL);
        glShaderSource(f,1,&amp;fs,NULL);
        free(vsFuente);free(fsFuente);
  
        glCompileShader(v);
        glCompileShader(f);
  
        glAttachShader(p,v);
        glAttachShader(p,f);
  
        glLinkProgram(p);
  
        //main loop
        while(1){
          ...etc.
  
                glUseProgram(p);
                  glEnableVertexAttribArray(0);
                    glBindBuffer(GL_ARRAY_BUFFER,triangleVBO);
                    glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,0);
                  glDisableVertexAttribArray(0);
                  glEnableVertexAttribArray(1);
                    glBindBuffer(GL_ARRAY_BUFFER,triangleTex);
                    glActiveTexture(GL_TEXTURE0);
                    glBindTexture(GL_TEXTURE_2D,idtextere);
                    glEnable(GL_TEXTURE_2D);
                  glDisableVertexAttribArray(1);
                glUseProgram(0);
  
          ...etc.
        }
  </code></pre>
  
  <p>This is my Vertex Shader:</p>
  
  <pre><code>void main(){
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = ftransform();
  } 
  </code></pre>
  
  <p>And this my Fragment Shader:</p>
  
  <p>uniform sampler2D tex;</p>
  
  <pre><code>void main(){
    vec4 color = texture2D(tex,gl_TexCoord[0].st);
    gl_FragColor = color;
  }
  </code></pre>
  
  <p>The problem is that the texture does not appear or anything else. I could say What's the problem?</p>
  
  <p>Thank you very much in advance.</p>