Using a single Render OP/Vertex Buffer for separate strips

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Using a single Render OP/Vertex Buffer for separate strips

Post by Mind Calamity »

So, adding to my previous question, I got to here: (screenshot) http://prntscr.com/5oc99i

In this case, would I have to use a separate vertexbuffer/render op for each different shape ?

What can I do to break the strips up ?
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Using a single Render OP/Vertex Buffer for separate stri

Post by Wolfmanfx »

join together triangle strips using degenerate triangles.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Using a single Render OP/Vertex Buffer for separate stri

Post by Kojack »

In directx (I know it's in dx10, not sure about dx9) you can restart a triangle strip or fan by giving an index of -1 (0xffff for 16 bit indices or 0xffffffff for 32 bit).
http://msdn.microsoft.com/en-us/library ... 85%29.aspx (at the bottom)

Opengl has it too, but you need to enable it with a couple of commands first (which ogre doesn't do, I searched the source).
https://www.opengl.org/wiki/Vertex_Rend ... ve_Restart
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: Using a single Render OP/Vertex Buffer for separate stri

Post by Mind Calamity »

From Wikipedia a degenerate triangle is a zero-area triangle, so how do I do this ?

I'm keeping all my vertices in a vector buffer and the layout is basically like this:

Current: ABC DEF
Would this fix it: ABC DDD DEF ?

That would technically be a zero-area "triangle", right ?

Edit: Apparently I wrote this and clicked Preview, damn...
@Kojack: I'm not using indices when filling the vertex buffer.
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Using a single Render OP/Vertex Buffer for separate stri

Post by Kojack »

Just remember that without indices, the gpu's vertex cache is disabled. Every vertex needs to be processed. So doing ABC DDD DEF means D is processed 4 times, whereas with indices it would be once (even ignoring the restart thing). Shouldn't be a problem, depending on the scene, but something to keep in mind if performance becomes an issue. (indexed triangle lists with optimised ordering can outperform triangle strips)

There's some examples of degenerate triangle strips here: http://stackoverflow.com/questions/1871 ... -triangles
Post Reply