opengl - What's the purpose of glVertexPointer? -
i looking @ particles examples of cuda , couldn't find make link between array of vertices , variables in shader. i've read , way i've been doing is
... glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); glbufferdata( ... ) glenablevertexattribarray(0); glvertexattribpointer( ... ); ...
however found in nvidia's example looks like
glbindbufferarb(gl_array_buffer_arb, m_vbo); glvertexpointer(4, gl_float, 0, 0); glenableclientstate(gl_vertex_array); if (m_colorvbo) { glbindbufferarb(gl_array_buffer_arb, m_colorvbo); glcolorpointer(4, gl_float, 0, 0); glenableclientstate(gl_color_array); } gldrawarrays(gl_points, 0, m_numparticles); glbindbufferarb(gl_array_buffer_arb, 0); gldisableclientstate(gl_vertex_array); gldisableclientstate(gl_color_array);
which believe similar do. questions are
- what's difference between 2 ways of passing data shader?
- should prefer 1 on other?
the first way modern, generic way of sending attributes. second 1 older, vertices, normals, colors etc. had own hard-coded attributes. should not used in modern code.
Comments
Post a Comment