Author Topic: Blending issue  (Read 682 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Blending issue
« on: December 25, 2012, 03:43:39 pm »
Hi I'm new to opengl and JCPT android. I tried putting in a texture with tranparency, and it shows up in an unexpected way. Did I miss anything? Could anyone show me the proper way to do it?


The code is as followed:


Code: [Select]
Config.glTransparencyMul = 1f;
Config.glTransparencyOffset = 1f;

frame = new FrameBuffer(gl, width, height);
world = new World();
world.setAmbientLight(20, 20, 20);


sun = new Light(world);
sun.setIntensity(250, 250, 250);
// Create a texture out of the icon...:-)
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(context.getResources().getDrawable(R.drawable.ic_launcher)), 64, 64));
TextureManager.getInstance().addTexture("texture", texture);
texture.setClamping(true);


plane = Primitives.getPlane(3, 10);
// cube.calcTextureWrapSpherical();
plane.setTexture("texture");
plane.setTransparency(0);
plane.strip();
plane.build();

Thanks for help ;)

[attachment deleted by admin]
« Last Edit: December 25, 2012, 03:48:33 pm by kkl »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Blending issue
« Reply #1 on: December 25, 2012, 03:47:00 pm »
To use the alpha channel from the image, you have to use the Texture-constructor with the useAlpha-flag set to true. The other constructors will create an alpha channel based on the (almost) black areas of the image.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Blending issue
« Reply #2 on: December 25, 2012, 03:50:50 pm »
Wow... Got it ;) Damn, you guys are efficient! Love the fast reply... Thanks alot haha