title: Enable alpha layer with OpenGL
body: <p>I use OpenGL with Lwjgl in Java.</p>
  
  <p>I just want to render my texture with alpha layer, but actually, it looks like this :
  <a href="http://puu.sh/8FRzn.png" rel="nofollow">http://puu.sh/8FRzn.png</a></p>
  
  <p>My configuration of OpenGL :</p>
  
  <pre><code>    glEnable(GL_TEXTURE_2D);   
  
      glBlendFunc (GL_ONE, GL_ONE);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_BLEND);
      GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);  
  
  
      GL11.glViewport(0, 0, screenWidth, screenHeight);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, screenWidth, screenHeight, 0, 1, -1);
      glMatrixMode(GL_MODELVIEW);
  </code></pre>
  
  <p>Et how I load my sprite sheet : </p>
  
  <pre><code>BLA BLA BLA ..
  public static HashMap&lt;String, Integer&gt; loadTexture(String path) {
      BufferedImage image = null;
      HashMap&lt;String, Integer&gt; hashMap = new HashMap&lt;String, Integer&gt;();
  
      try {
          image = ImageIO.read(new File(path));
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      int w = image.getWidth();
      int h = image.getHeight();
  
      int[] pixels = image.getRGB(0, 0, w, h, null, 0, w);
  
      ByteBuffer buffer = BufferUtils.createByteBuffer(w * h *4);
  
      for(int x = 0; x&lt;w; x++) {
          for(int y = 0; y&lt;h; y++) {
              Color color = new Color(pixels[x + y * w]);
  
              buffer.put((byte)color.getRed());
              buffer.put((byte)color.getGreen());
              buffer.put((byte)color.getBlue());
              buffer.put((byte)color.getAlpha());
          }
      }
      buffer.flip();
  
      int id = glGenTextures();
  
      glBindTexture(GL_TEXTURE_2D, id);
  
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
  
      hashMap.put("width", w);
      hashMap.put("height", h);
      hashMap.put("id", id);
  
      return hashMap;
  }
  </code></pre>
  
  <p>And I render it with common method : GL_QUADS</p>
  
  <p>Yes, my texture have a Alpha Layer : <a href="http://puu.sh/8FS15.png" rel="nofollow">http://puu.sh/8FS15.png</a></p>
  
  <p>I already searched across the web to find answer but my OpenGL "Configuration" is the same as the solutions given each time ..</p>