#### Archived

This topic is now archived and is closed to further replies.

# Drawing a quad with ONE strip

This topic is 6027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is it possible, to draw a quad (consisting of (forExample) 9 vertices), in ONE triangle strip ? The quad: 0 1 2 3 4 5 6 7 8 If I could do that, it would give my app a hardcore-speedUp. I''ve wasted thousands of pencils and sheets of paper to solve this prob, but I failed....... My best approach was this one: 0, 3, 1, 4, 2, 5, 8, 4, 7, 3, 6 But it''s buggy... ( Because of 2, 5, 8 ) :-((( Do you have an better idea ?

##### Share on other sites
Sorry if I''m not being too helpful here, but why does the quad need 9 vertices? If it''s really a quad you only need the 4 corners. Vertices 1,3,5 and 8 must be in line with the edges of the quad and 4 isn''t needed either. In that case you could do it in a triangle strip.

##### Share on other sites
You''d use a 9-point quad for things such as terrain.

And I think what you need is a triangle fan, not a strip.
Works great. =)

- Mike

##### Share on other sites
Yeah, I've had this problem, too. I'm not sure if it can actually be done with one GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN call. I have eight vertices, which make a 3D cube or cuboid, with 2 triangles for each of 6 faces, when constructed. I have to render them using GL_TRIANGLES, because I haven't been able to find a method for winding the vertices properly.

I have found that for objects such as walls, GL_TRIANGLE_STRIP, if I could find the winding order, is actually more inefficent than GL_TRIANGLES. I suppose triangle strips should only be used when drawing models, which have enough vertices to warrant a decent drop in function calls to glVertex*.

If anyone does know a winding order to draw 12 triangles, which create 6 sides, I'd be glad to know it, but I don't think it can be done...

Edited by - iNsAn1tY on January 14, 2002 5:31:49 PM

##### Share on other sites
Um, a quad always has 4 vertices. That''s why it''s called a quad.

www.elf-stone.com

##### Share on other sites
With "quad" I mean that it has a square shape. And mkaltner said, I need it for a landscape (You''re smart ;-)).
But as some of you said, I can''t use a fan, because the real size is 33x33 vertices (This here is just a simplyfied example).

My biggest problem is that I need 32 calls to glDrawElements(), to draw my quad. If I could draw all triangles with ONE call, the frame rate would be twice as high !!!
(I tried that, but I don''t know how to bring the vertices in a proper order)

Could anyone tell me what other possibilities I have to draw such a quad ? Perhaps I could tell glDrawElements() to draw it as triangles (not as a strip). How would my vertex-array have to look like then ?

thx, VanKurt

##### Share on other sites
FFS, don''t misuse terms then. When you come in the OpenGL forum talking about quads, you can expect people to think you''re talking about 4 sided polygons. If you''d got as far as reading the definition in the docs for glBegin()/glEnd() you would know that.

Also, learn to spell.

www.elf-stone.com

##### Share on other sites
One quick note... while your use of "quad" in the sense of a 4-sided figure is valid, the term "quad" in a computer graphics context usually means two triangles stuck together. Minor point, but as mentioned, it helps to avoid confusion.

What you are looking to do can be done with the help of degenerate triangles. A degenerate triangle is one with no area; it can be created by duplicating a vertex index. Most 3d hardware can recognize these and either efficiently drop them or render them (which, since they are degenerate, does not affect output).

So, one way to tristrip your square mesh would be:

0 3 1 4 2 5 5 8 7 4 3 6

or even

0 3 1 4 2 5 5 3 3 6 4 7 5 8

Don''t immediately throw out the last because it''s longer... (nor immediately accept it because I told you not to throw it out). There are many factors involved in getting full performance. Vertex cache is one, and potentially neither of the above are the best way to do it (for longer strips, that is). Some platforms, also, could do this without degen tris (PS2, for example) by using draw kick bits... not that the PS2 can''t handle a degen, but it may be better to do it other ways and save a little DMA.

---- --- -- -

##### Share on other sites
Well, from the large number of different things you are wanting to do, why not just toss out all the triangle strips, fans, quads, loop de loops, and cubes and just use indexed vertecies. It has about the same performance gain I think and allows you to do anything you want.

##### Share on other sites
Well, glDrawElements() is used with indexed vertices so I assume that is already what he is doing..

''Very funny, Scotty. Now beam down my clothes.'' -

[TheBlackJester]

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 29
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631740
• Total Posts
3001959
×