If any other OpenGL function is called between glBegin and glend, the error flag is set and the function is ignored. You can also use glCallList or glCallLists to execute display lists that include only the preceding functions. You can use only a subset of OpenGL functions between glBegin and glend. Taking n as an integer count starting at one, and N as the total number of vertices specified, the interpretations are as follows: The glBegin function accepts a single argument that specifies which of ten primitives the vertices compose. The glBegin and glend functions delimit the vertices that define a primitive or a group of like primitives. The function glend was called before the corresponding glBegin was called, or glBegin was called within a glBegin/ glend sequence. NameĪ function other than glVertex, glColor, glIndex, glNormal, glTexCoord, glEvalCoord, glEvalPoint, glMaterial, glEdgeFlag, glCallList, or glCallLists was called between glBegin and the corresponding glend. The following error codes can be retrieved by the glGetError function. Vertices 1 through N define this polygon. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.ĭraws a single, convex polygon. Vertices 2n - 1, 2n, 2n + 2, and 2n + 1 define quadrilateral n. One quadrilateral is defined for each pair of vertices presented after the first pair. N/4 quadrilaterals are drawn.ĭraws a connected group of quadrilaterals. Vertices 4n - 3, 4n - 2, 4n - 1, and 4n define quadrilateral n. Treats each group of four vertices as an independent quadrilateral. Vertices 1, n + 1, n + 2 define triangle n. one triangle is defined for each vertex presented after the first two vertices. N - 2 triangles are drawn.ĭraws a connected group of triangles. For even n, vertices n + 1, n, and n + 2 define triangle n. For odd n, vertices n, n + 1, and n + 2 define triangle n. One triangle is defined for each vertex presented after the first two vertices. N/3 triangles are drawn.ĭraws a connected group of triangles. Vertices 3n - 2, 3n - 1, and 3n define triangle n. Treats each triplet of vertices as an independent triangle. The last line, however, is defined by vertices N and 1. N - 1 lines are drawn.ĭraws a connected group of line segments from the first vertex to the last, then back to the first. N/2 lines are drawn.ĭraws a connected group of line segments from the first vertex to the last. Treats each pair of vertices as an independent line segment. The following are accepted symbolic constants and their meanings: Value The primitive or primitives that will be created from vertices presented between glBegin and the subsequent glend. As NewBreed has mentioned, other things like triangle strips are also possible and perform faster since (after the initial triangle) one new triangle per provided vertex is rendered.The glBegin and glend functions delimit the vertices of a primitive or a group of like primitives. On the other hand, if you want to use the immediate rendering mode, then using quads is senseful since it requires 4 vertices in comparison to 6 vertices for 2 equivalent triangles. There are also stripifying algorithms out there if your meshes are suitable for that kind of organization. However, that might be difficult to reach. modern GPUs have vertex caches inside, so that vertex soup organization can yield in faster rendering than any other, if the vertices are requested so that mainly cache hits occur. Organizing the triangles as strips or as a soup can both have advantages w.r.t. Since you have the need of triangles and quads can be converted easily into triangles, obviously triangles would be the choice. In order to have only 1 draw routine invocation, all primitives in that VBO should be of the same type. Assuming a mesh in your sense consists of several hundret faces at least, the fastest way is put it into a VBO. fastest) way to render is those that requires the lowest count of invocations of OpenGL routines.