Blending issue

Started by kkl, December 25, 2012, 03:43:39 PM

Previous topic - Next topic

kkl

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:



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]

EgonOlsen

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.

kkl

Wow... Got it ;) Damn, you guys are efficient! Love the fast reply... Thanks alot haha