gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > New triangle strip command

#175687 - Rajveer - Sun Jan 16, 2011 11:06 pm

Is there a gfx command for beginning a new triangle strip in a display list, without using a BEGIN_VTXS/ END_VTXS combination? I'm saving a few strips of triangles to a display list, and since I'm not beginning drawing of a new type of polygon, I'm curious if there is a way to avoid using those vertex commands between strips.

#175688 - elhobbs - Mon Jan 17, 2011 12:49 am

BEGIN_VTXS is required. END_VTXS is not required on hardware. triangle strips use connected trianges - so, no you can not skip BEGIN_VTXS to start a new strip.

#175689 - Rajveer - Mon Jan 17, 2011 1:27 pm

Cool, at least I can skip the END_VTXS command, thanks for that tip. I read that the BEGIN_VTXS and END_VTXS commands should be used sparingly as they're relatively slow, so was just curious.

#175698 - ritz - Tue Jan 18, 2011 3:01 pm

Those commands are only a single cycle, shouldn't be a big deal.

Code:
  Address  Cmd Pa.Cy.
  4000500h 40h 1  1   BEGIN_VTXS - Start of Vertex List (W)
  4000504h 41h -  1   END_VTXS - End of Vertex List (W)

http://nocash.emubase.de/gbatek.htm#ds3diomap

#175708 - Rajveer - Tue Jan 18, 2011 11:27 pm

Oh yeah, so they are, thanks. Forgot that gbatek has the number of cycles for hardware commands :)

#175709 - TwentySeven - Wed Jan 19, 2011 2:46 am

You can in fact do what you originally asked, by using duplicate vertexes to create a degenerate triangle to branch to the start of a new spatially discreet strip.

The simplest way to think of it is if you have two disconnected strips consisting of say:

a-b-c-d-e-f-g and h-i-j-k-l-m-n-o-p

you would pack it as a single strip like so

a-b-c-d-e-f-g-h-h-h-i-j-k-l-m-n-o-p

the triangle formed by h-h-h would be degenerate and invisible, allowing you to span space without drawing anything.

This pointless tip brought to you by: "Starting a new strip is cheaper because of vertex counts", and "This doesn't save you anything on the PC either because of vertex transform caching and indexed triangles are cheaper anyhow"