(Android) Stencil buffer not enabled

Hi,

I’m trying to clip a sprite with ccclippingnode in Android but I get the message:

Stencil buffer is not enabled.

I’ve changed my activity to set the EGL config to:
glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 8);

but the message is always displayed.

Any ideas?

Tx,
M.

I supposed you use v2.x version. So you can refer to cocos2d-x/samples/Cpp/TestCpp/proj.android/src/org/cocos2dx/testcpp/TestCpp.java.

2 Likes

Hi Minggo,

Your projects works fine. But I don’t understand. When I execute this code:

glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits);

I get -1. But the only configuration is in your main activity, just creating the eaglview. I have the same configuration than your testcpp.java

I’m trying to create a mask in response to pickup a photo from gallery. Could be anything related to thread’s stuff?

Tx,
M.

Yes, it was definitively a thread issue. I’m creating a clippingnode in response to a native call from java to cocos2dx. I’ve moved the code to a callfunc action an now works ok. Do you know if the native code is always called not in the main thread?

Tx,
M.