The previous chapter explains the use of Clipplingnode to create masks to display irregular graphics. But this has been to the Android side, but there are problems in some phones.
The specific problem shows: white screen, only the boundary (upper right corner) has a rectangular color block.
This is actually a problem when the framework does not have the stencil buff enabled on the Android phone when the reference Oenngl is set .
Solution, add the following in the Oncreateview constructor:
Cocos2dxglsurfaceview Glsurfaceview = new Cocos2dxglsurfaceview (this); Glsurfaceview.seteglconfigchooser (5, 6, 5, 0, 16 , 8);
Open The implementation of the Cocos2dxglsurfaceview, and found that there is no seteglconfigchooser function, and Cocos2dxglsurfaceview inherits from Glsurfaceview. Query the glsurfaceview, found that there are APIs:
void Seteglconfigchooser (int redsize, int greensize, int bluesize, int alphasize, int depthsize, int stencilsize)//install A config chooser which would choose a config with at least the specified component sizes, and as close to the specified co Mponent sizes as possible.
As you can see here, the last parameter is the setting for stencil , and in cocos2dxactivity 's internal initialization, we can see that the setting is:
if (Isandroidemulator ()) This.mGLSurfaceView.setEGLConfigChooser (8, 8, 8, 8, 16, 0);
For a list of other blogs related to making games, I putUse cocos2dx3.2 to make a gravity version of Tetris (Crazy Tetris)
cocos2dx3.2 Crazy Tetris Part of the phone caused by a mask white screen