Texture transparency problem with P3D for Doom clone

This is the bit of code that draws my enemy : I’ve also rendered a video with the bug that can be viewed here > https://youtu.be/AI0y671POLo - thanks in advance!!! :slight_smile:

void drawItem(String type) {
    if (type == "pHealth") {
      lightFalloff(0.0001, 0.0001, 0.0001);
      if (lightsOn)pointLight(255, 0, 0, 0, 0, 0);
      drawCube(pHealth);
    }
    if (type == "crate") {
      drawCube(crate);
    }
    if (type == "enemy") {
      lightFalloff(0.0001, 0.0001, 0.0001);
      if (lightsOn)pointLight(180, 255, 0, 0, 0, 0);
      //blendMode(SCREEN);
      //hint(DISABLE_DEPTH_MASK);
      pushMatrix();
      rotateY(x);
      beginShape();
      texture(enemy);      
      //println(x);
      // +Z "front" face
      vertex(-64, -64, 0, 0, 0);
      vertex( 64, -64, 0, 64, 0);
      vertex( 64, 64, 0, 64, 64);
      vertex(-64, 64, 0, 0, 64);
      endShape();
      popMatrix();
      //hint(ENABLE_DEPTH_MASK);
      //blendMode(BLEND);
    }
  }

I’m using a PNG that should be transparent - I’ve also tried to mask it by using :slight_smile:

enemy = loadImage("enemy.png");
  enemy.mask(loadImage("enemy_mask.png"));

but to no avail… I should specify I’m using Processing 2.2.1

1 Like