Jump to content
  • Advertisement


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


D3D and ROAM

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. I''ve been looking into ROAM as my LOD algo for my terrain. It looks like it will work out great, but I have one question in regards to rendering it with D3D... At run time, ROAM makes a big binary triangle tree of all of the triangles in the scene. Then, at render it loops through getting the (x, y, z) coordinate for each vertex and renders as a triangle list. My question is, what''s the best way to do this with D3D? examle code: RecurrsiveFunction( coordinates of triangle ) { // Get the three verts of the triangle. // Render them? // Pass on info for the children triangles (ones split from us) } Now, as you can see that will result in a whole lot of DrawPrimitive() calls which will be incredibly slow my intuition tells me =). So, what to do? With OpenGL you can pass verts one at a time (glVertex3f() or something like that). Any ideas? Thanks in advance!! -Snowman

Share this post

Link to post
Share on other sites
I don''t know a whole lot about vertex buffers, but the way I understand it, Vertex buffers are filled using Lock() and Unlock() right? Well, I''ve also heard that it''s slow to do that over and over which is what I''d have to do in order to add all of my triangles...

Any other ideas?



Share this post

Link to post
Share on other sites
Yeah, one idea is to call the recursive function and just
do a single lock before you enter, then unlock and a call
to drawprimtive when your finished.

Of course you will have to take into account vertex limits
on the buffers etc.


// Get 3 verts for triangle
// Check space left in VB
// if so add them
// if not DrawPrimitive VB with current set of triangles
// and switch to another VB to start filling

// Recursive function to next tri''s

Draw Remaining tri''s.

Obviously this is a basic outline of what needs to be


Share this post

Link to post
Share on other sites
This sounds like a good idea, I''ll try it out and compare speeds to see if it''s faster than calling a bunch of drawprimitives(). Thanks!


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!