title: Render textured point sprites using GLFW
body: <p>I'm currently rendering a bunch of points to which I'd like to apply a texture using point sprites. To load my texture, I'm using GLFW. I followed the instructions in the OpenGL Super Bible chapter on this, but when I try to apply the texture in my fragment shader, it doesn't work.</p>
  
  <p>Here are some of my code snippets on this:</p>
  
  <pre><code>//Variables
  GLuint starTBO;
  GLuint location_texture = 0;
  
  // Set location (in main function)
  glUseProgram(shader_program2);
  location_texture = glGetUniformLocation(shader_program2, "sprite_texture");
  glUseProgram(0);
  
  // Set Texture (in main function)
  glGenTextures(1, &amp;starTBO);
  glBindTexture(GL_TEXTURE_2D, starTBO);
  if(glfwLoadTexture2D("stone.tga", GLFW_BUILD_MIPMAPS_BIT))
  {
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  }
  glEnable(GL_TEXTURE_2D);
  
  // in display method
  glUseProgram(shader_program2);
  glActiveTexture(GL_TEXTURE0 + 0);
  glUniform1i(location_texture, 0);
  ...
  
  // Fragment shader
  const GLchar *fragment_shader2 =
  "#version 330\n"
  "out vec4 out_color;"
  ""
  "uniform sampler2D sprite_texture;"
  ""
  "void main()"
  "{" 
  "   out_color = texture(sprite_texture, gl_PointCoord) + vec4(1.0, 0.0, 0.0, 1.0);"
  "}"
  </code></pre>
  
  <p>Point Sprite mode is enabled in my initGL method. What could be the reason why texture isn't applied to the points?</p>
  
  <p>EDIT: I inserted an if-statement to see whether the call to glfwLoadTexture2D isworking properly, and indeed it is not. What could cause this to fail? I tried using the relative and the real path as a parameter, but still no change. I also tried using different .tga images. Anyone, still haven't figured out why it won't work?</p>
  
  <p>EDIT 2: Could it be that freeglut and glfw don't work together?</p>