OpenGL ES Learning

Source: Internet
Author: User

A vertex set:

private float vertices[] = {      -1.0f,  1.0f, 0.0f,  // 0, Top Left      -1.0f, -1.0f, 0.0f,  // 1, Bottom Left       1.0f, -1.0f, 0.0f,  // 2, Bottom Right       1.0f,  1.0f, 0.0f,  // 3, Top Right              2.0f,  1.0f, 0.0f,  // 4, Top 2Right       2.0f, -1.0f, 0.0f,  // 5, Bottom 2Right};

Set to draw only the front (counterclockwise)

GL. glfrontface (gl10.gl _ CCW); // OpenGL docs // enable face culling. GL. glable (gl10.gl _ cull_face); // OpenGL docs // What faces to remove with the face culling. // GL. glcullface (gl10.gl _ front_and_back); // OpenGL docs removes the rendering GL from a certain surface. glcullface (gl10.gl _ Back); // OpenGL docs

Use gl10.gl _ triangle_strip

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0,6);

According to the online tutorial, the triangle should be drawn as follows:

012 (), 123 (), 234 (clockwise), 345 (clockwise)

The first two triangles are displayed. The actual result is that the values 0 12 (counterclockwise), 345 (clockwise ),

Searching for details

To sum up, we found that the triangle at the even position was calculated in reverse order, that is, it turns clockwise in the original clockwise direction.

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.