Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - shabeepk

Pages: [1]
1
Support / Re: Overlay PNG Transparency
« on: September 15, 2011, 02:16:11 am »
I am using it in an overlay.

I am not manually blitting it. How do i set transparent = true when using an overlay. I tried searching something like that but didn't find it.

Please advise.

2
Support / Overlay PNG Transparency
« on: September 14, 2011, 02:34:22 pm »
Hello all,

I am very new to JPCT. I am developing an application on android using JPCT and want to add some overlay textures to it.

I am adding the overlay in the onSurfaceChanged method like this:

Code: [Select]
public void onSurfaceChanged(GL10 gl, int w, int h)
{
if (fb != null)
{
fb.dispose();
}

fb = new FrameBuffer(gl, w, h);

int displayWidth = fb.getWidth();
int displayHeight = fb.getHeight();

int centerX = displayWidth / 2;
int centerY = displayHeight / 2;

Log.i(this.getClass().toString(), "Creating overlay crosshair at : [" + displayWidth + ", " + displayHeight + "]");
Overlay crosshairOverlay = new Overlay(world, centerX - 15, centerY - 15, centerX + 15, centerY + 15, "crosshair");

crosshairOverlay.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
}

My Activity's onCreate method looks like this

Code: [Select]
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

mGLView = new GLSurfaceView(getApplication());

mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser()
{
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
{
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);

return configs[0];
}
});

renderer = new MyRenderer();
mGLView.setRenderer(renderer);
setContentView(mGLView);
}

I am loading the texture (which is a PNG file with transparent pixels) in the onSurfaceCreated method like this:

Code: [Select]
Texture crosshair = new Texture(BitmapHelper.convert(getResources().getDrawable(R.drawable.crosshair)), true);

Now the issue is, when the overlay gets shown, it shows the transparent pixels as black.

Am I missing something? I was thinking I may need to enable opengl alpha blending somehow, but I don't know how to do that using JPCT.

Any help would be really appreciated ...

Thanks


Pages: [1]