Modify window background color in cocos2d-x

Source: Internet
Author: User

The default window background color in the cocos2d-x is black. This seems to be because the default initialization color of opengl is black. Since it is rendered by opengl, the initialized color must be processed by the gl function. The following [cpp] glClearColor (0.0f, 0.0f, 0.0f, 1.0f); glClearColor (0.0f, 0.0f, 0.0f, 1.0f); find a [cpp] void CCDirector: setgldefadefavalues (void) {// This method shocould be called only after openGLView _ was initialized CCAssert (m_pobOpenGLView, "opengl view shocould not be null"); setAlphaBlending (true); // XXX: Fix me, shocould enable/disable depth test according the depth Format as cocos2d-iphone did // [self setDepthTest: view _. depthFormat]; setDepthTest (true); setProjection (m_eProjection); // The default colors glClearColor (0.0f, 0.0f, 0.0f, 1.0f) are set here; // glClearColor (255.0f, 255.0f, 255.0f, 1.0f);} void ccctor ctor: setgldefavaluvalues (void) {// This method shocould be called only after openGLView _ was initialized CCAssert (m_pobOpenGLView, "opengl view shocould not be null "); set AlphaBlending (true); // XXX: Fix me, shocould enable/disable depth test according the depth format as cocos2d-iphone did // [self setDepthTest: view _. depthFormat]; setDepthTest (true); setProjection (m_eProjection); // The default colors glClearColor (0.0f, 0.0f, 0.0f, 1.0f) are set here; // glClearColor (255.0f, 255.0f, 255.0f, 1.0f);} the bottom is white.

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.