c++ - How do I use GLTriangleBatch -


i developing real world application render solid white polygons on screen, , change alpha values time passes. trying learn how use gltrianglebatch perform (i know c++ well, not opengl), , have not been able find examples online. far, have found few resources led me put following bit of code, still confused on portions:

gltrianglebatch mytriangles; mytriangles.beginmesh(1000000); // include how many vertices have: 1??? mytriangles.addtriangle(...);   // add triangle: 2???  // repeat triangles batch mytriangles.end();  // done adding triangles mytriangles.draw(); // draw triangles 

i have marked portions confused on ???, , questions appear below:

  • question 1: number of vertices have exact, or okay over-estimate , / or underestimate? furthermore, number of vertices represent "batched" vertices, or individual vertices of each triangle (e.g. 2 connected triangles 2 shared vertices require 6 vertices or 4?)

  • question 2: paramaters are:

    • m3dvector3f verts[3]: assume 3 vertices of triangle
    • m3dvector3f vnorms: this, , how set up?
    • m3dvector2f vtexcoords[3]: assume texture, want white triangle, , able vary alpha value of it. how set up?

this gltrianglebatch class apparently part of framework provided opengl super bible book. not part of opengl standard (opengl plain c api).

as first question, assume nmaxverts parameter of beginmesh() upper limit of vertexes want draw (each triangle = 3 verts). can set either exact value or over-estimate. you'd have find documentation or @ source know sure.

for second question, yes verts[3] 3 positions make triangle. vnorms face normal of triangle. used lighting calculation. , last member, vtexcoords[3] texture coordinates of triangle. these used texture mapping. can set them 0 if not applying texture mesh.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -