VA, Vao, and VBO API memos

Source: Internet
Author: User
Origin

Contact OpenGL for some time, most of the time is the use of OSG in the development, a few days ago, colleagues asked about OpenGL VBO related content, only to find a lot of OpenGL knowledge unfamiliar. The two smallpox had a little time to re-review the content related to Vbo, recorded here for forgetting. Most of the content comes from the web. Overview

OpenGL has divided the API into two types from OpenGL 3.0: The Legacy OpenGL (Legacy OpenGL) and the new OpenGL (Core profile), OpenGL3.3 's official API document that completely describes the new OpenGL API, the legacy OpenGL API can be viewed in OpenGL 2.1.

The first station for OpenGL rendering: The introduction of vertex data (including vertex position, vertex normals, vertex colors, texture coordinates, etc.) into OpenGL, which is implemented in the following ways in legacy OpenGL: Immediate Mode (glbegin/glend) This is probably the first API to learn OpenGL exposure, at least I do. But unfortunately, it's been abandoned by new OpenGL.
A vertex array (Va:vertex array) reduces the call cost of the function compared to the immediate mode. It is also currently being compared to VA by the new OpenGL discard buffer Object (Vbo:vertex), which stores the data on the server side (VA is stored on the client). is currently the only data incoming method supported by new OpenGL
The display list compiles several OpenGL commands, which are called directly by the video card. Because the compiled modules cannot be modified, the flexibility is lost. And abandoned by new OpenGL.

In addition, VBO is used in legacy OpenGL and core profile OpenGL in different ways. VA API

(1) Turn VA on and off

[CPP]  View Plain  copy  //Turn on and off client status    void glenableclientstate (glenum cap);    Void gldisableclientstate (GLENUM CAP);     //parameter Cap value    gl_vertex_ array                 // Vertex position          gl_color_array                   //Vertex color    gl_edge_flag_array               //vertex boundary line identification    GL_FOG_ coord_array              //Vertex fog coordinates     gl_index_array                   //Vertex index    gl_normal_array                  //Vertex normals    gl_secondary_color_array             //vertex auxiliary Colors    gl_texture_coord_array               //Vertex Texture coordinates   

(2) Set data to vertex

[CPP]  View Plain  copy  //////////////////////////////////////////////////////////////////////////   //The following is a set of api  //parameter values for setting vertex data (default parameters represent default values in OpenGL):  // size    Dimensions describing data (2d\3d)    // type    describe the type of each data    // stride  Describe the span of each vertex data   //pointer  point to the actual data         //Set vertex position data    void  glvertexpointer ( GLint size=4,  GLenum type=GL_FLOAT,  GLsizei  stride=0,  const glvoid *pointer=0);   //Set vertex color data    void  Glcolorpointer ( glint size=4,  glenum type=gl_float,  glsizei stride=0 ,   const glvoid *pointer=0);   //Set vertex boundary line identification Data    void  Gledgeflagpointer ( glsizei stride=0,  const glvoid *pointer=0);    //Set vertex fog coordinate data    Void glfogcoordpointer ( GLenum type=GL_FLOAT, GLsizei stride=0,   glvoid *pointer=0);   //Set vertex index data    void glindexpointer ( GLenum  type=gl_float,  glsizei stride=0,  const glvoid *pointer=0);    //Set vertex normals data    void glnormalpointer ( glenum type=gl_float,  glsizei  stride=0,  const glvoid *pointer=0);   //Set vertex-assisted color data    void  glsecondarycolorpointer ( glint size=3,  glenum type=g

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.