View Full Version : GL_QUAD_STRIP

johnnyp05

10-10-2005, 12:52 PM

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...

Ojama

10-10-2005, 02:06 PM

Originally posted by johnnyp05:

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...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

memfr0b

10-11-2005, 12:16 AM

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.htmlFor 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.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.