cocos2dx3.2 Crazy Tetris Part of the phone caused by a mask white screen

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.