text: #ifndef LOAD_AND_BIND_TEXTURE_H
  #define LOAD_AND_BIND_TEXTURE_H
  
  #ifdef __APPLE__
  #include <GLUT/glut.h>
  #else
  #include <GL/glut.h>
  #endif
  
  unsigned int load_and_bind_texture(const char* filename)
  {
      char* image_buffer = NULL; // the image data
  	int width = 0;
  	int height = 0;
  
  	// read in the PNG image data into image_buffer
  	if (png_load(filename, &width, &height, &image_buffer)==0)
      {
          fprintf(stderr, "Failed to read image texture from %s\n", filename);
          exit(1);
      }
  
  	// request one texture handle
  	unsigned int tex_handle = 0;
  	glGenTextures(1, &tex_handle); 
  
  	// create a new texture object and bind it to tex_handle
    	glBindTexture(GL_TEXTURE_2D, tex_handle);
  
  	// so we can blend it 
    	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
  
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  
    	glTexImage2D(GL_TEXTURE_2D, 0, 
  				GL_RGBA, width, height, 0,
     		 		GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)image_buffer);
  
      glBindTexture(GL_TEXTURE_2D,0);
  
  	free(image_buffer); // free the image buffer memory
  	
  	return tex_handle;
  }
  
  #endif //LOAD_AND_BIND_TEXTURE_H
  