www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kkl on December 25, 2012, 03:43:39 pm

Title: Blending issue
Post by: kkl 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]
Title: Re: Blending issue
Post by: EgonOlsen 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.
Title: Re: Blending issue
Post by: kkl on December 25, 2012, 03:50:50 pm
Wow... Got it ;) Damn, you guys are efficient! Love the fast reply... Thanks alot haha