Saturday, September 10, 2022
HomeGame Developmentopengl es - How to clip or masks entity in android/andengine?

opengl es – How to clip or masks entity in android/andengine?


I need to implement masking with sprite in Andengine. I would like similar performance as in ios class referred to as

SKCropNode

which works like an masking node!
Is there any workaround like this in andengine/opengl ?
Thanks.

Edit:
This is one thing I used to be attempting to masks an entity, bought no impact, any suggestion?

public class ClippingEntity extends Entity//BaseSprite
{

protected int mWidth;
protected int mHeight;

public ClippingEntity(float pX, float pY, int pWidth, int pHeight, TextureRegion t)
{
    tremendous(pX, pY);//, pWidth, pHeight, t);
    mWidth = pWidth;
    mHeight = pHeight;
}

@Override
protected void onManagedDraw(GL10 pGL, Camera pCamera)
{

    pGL.glPushMatrix();
    {

        pGL.glEnable(GL10.GL_SCISSOR_TEST);
        pGL.glScissor(0 + (int) mX, 800 - mHeight + (int) mY, mWidth, mHeight);

        tremendous.onManagedDraw(pGL, pCamera);

        pGL.glDisable(GL10.GL_SCISSOR_TEST);

    }
    pGL.glPopMatrix();

}

}

I’ve additionally tried Stencil Test nevertheless it simply clears the colour of rectangle. ref: opengl masks exams

Ultimate objective is to disable drawing modifications in particular entity the place it could aslo have clear background.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments