"Cocos2d-x" prompted error when compiling Android project: ' Gl_line_smooth ' is not declared in this scope

Source: Internet
Author: User

OpenGL is used in the Cocos2d-x project, and line antialiasing is turned on using Gl_line_smooth. The code is as follows:

CCDRAWCOLOR4B (50, 26, 12, 255);//Set line width gllinewidth (2.0f); Enable segment anti-aliasing glenable (Gl_line_smooth); Draw the first line ccdrawline (startpoint1,endpoint);//Draw the second line ccdrawline (startpoint2,endpoint);//Turn off segment anti-aliasing gldisable (gl_line_ SMOOTH);
Error when compiling Android project with NDK: ' Gl_line_smooth ' is not declared in this scope


Development Environment Description:

Engine version

cocos2d-x2.2.1

Development tools

Visual Studio 2012

Android NDKR9

System

Windows7


Error: ' Gl_line_smooth ' is not declared in this scope, indicating that Gl_line_smooth did not find the definition.

1. Then open the Cocos2d.h and locate the OpenGL-related header file under the Android platform CCGL.h


2.ccgl.h contains header files in Gl2.h and gl2ext.h two header files,<> is preferred in system path lookup


So we go to the NDK path to find the file, these two header files are in the GLES2 directory, the directory contains OpenGL ES2.0 related header files


The definition of Gl_line_smooth was not found after viewing gl2.h and glext.h, indicating that this could be defined in the OpenGL ES1.0 related header file

3. Then go to the Gles directory to find


So I found the definition of Gl_line_smooth in the gl.h header file.


4. In the CCGL.h header file under the Android platform, # include <GLES/gl.h> will solve the problem.




"Cocos2d-x" prompted error when compiling Android project: ' Gl_line_smooth ' is not declared in this scope

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.