Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Tried this code, but the texture didnot get any lighter.

    try {
        texture = TextureLoader.getTexture("png",                                
           Game.class.getResourceAsStream("/brick.png"), true, GL_NEAREST);
    } catch (IOException e) {

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());

    GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.5f);

    glColor4f(1, 1, 1, 0.5f);
    GL11.glBegin(GL11.GL_QUADS);          // Start Drawing Quads
    // Front Face
    GL11.glNormal3f(0.0f, 0.0f, 1.0f);    // Normal Pointing Towards Viewer
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);  // Point 1 (Front)
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);   // Point 2 (Front)
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);    // Point 3 (Front)
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);   // Point 4 (Front)
share|improve this question
up vote 2 down vote accepted

This is not how blending works, it doesn't work on the same polygon. Blending blends between more polygons (or fragments to be more correct). But you can use blending for lighting or darkening textures of course, its good idea actually.

Simple solution is to draw first quad with texture and then draw quad with blending enabled with blending color on it. But the second quad must be slightly moved to the direction of the camera. Something like this: GL11.glVertex3f(-1.0f, -1.0f, 0.99f);

Much nicer and cleaner solution would be first draw quad with texture and than qaud with color at the same position but setup zBuffer comparison function to equal.

And remember with alpha blending do not forget that you always first render opaque objects and then transparent.

And once you start using shaders this will be trivial operation on fragment/pixel shader with no need of blending.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.