Hi, can someone give me a simple example of a 2D quad strip.

im using

glBegin(GL_QUAD_STRIP);

glVertex2i(1, 1);

glVertex2i(1,-1);

glVertex2i(1, 1);

glVertex2i(1, -1);

glEnd();

But nothing…

Hi, can someone give me a simple example of a 2D quad strip.

im using

glBegin(GL_QUAD_STRIP);

glVertex2i(1, 1);

glVertex2i(1,-1);

glVertex2i(1, 1);

glVertex2i(1, -1);

glEnd();

But nothing…

Originally posted by johnnyp05:

[b]Hi, can someone give me a simple example of a 2D quad strip.

im using

glBegin(GL_QUAD_STRIP);

glVertex2i(1, 1);

glVertex2i(1,-1);

glVertex2i(1, 1);

glVertex2i(1, -1);

glEnd();

But nothing…[/b]

That’s probably because you don’t have any polygons(well, quadrilaterals). I drew it out and it made a line shape. try something like:

(1,1)(1,-1)(2,-1)(2,1)(3,1)(3,-1)(4,-1)(4,1)

Think castle tower wall.

"GL_QUAD_STRIP

Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices 2n−1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2−1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.

"–http://pyopengl.sourceforge.net/documentation/manual/glBegin.3G.html

Originally posted by Ojama:

try something like:

(1,1)(1,-1)(2,-1)(2,1)(3,1)(3,-1)(4,-1)(4,1)

Think castle tower wall.

Which, unfourtunately, is exactly the wrong vertex order, as the quoted part of the manual page explains. The correct order would be:

"GL_QUAD_STRIP

Draws a connected group of quadrilaterals. One quadrilateral is defined for each pair of vertices presented after the first pair. Vertices 2n−1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2−1 quadrilaterals are drawn. Note that the order in which vertices are used to construct a quadrilateral from strip data is different from that used with independent data.

"–http://pyopengl.sourceforge.net/documentation/manual/glBegin.3G.html

For n=1 for example, this will select the vertices with indices 1, 2, 4, 3. Which gives the properly CCW wound quad (1,1) (1,-1) (2,-1) (2,1). This is the same vertex order as for triangle strips.