Jump to content
  • Advertisement
Sign in to follow this  
codeman_nz

Multiple calls to line strip

This topic is 2529 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

Hi Everyone,

I put this on the graphics programming board but no one responded so I will put it on here.

Is it possible to have multiple calls to line strip using different vertices.

What I am doing is I have a loop with a bezier curve. In the loop it calculates the bezier point and another point above and below the point and the goal is to draw three separate lines with each of those points. At the moment I just put them into three arrays and then call glVertexPointer and glDrawArrays but it looks too ugly.

Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Not really sure why 3 seperate renders look 'bad' as they wont have the connecting lines/triangs of trying to stuff all the data into one render.
DO these lines touch and they get garbled looking (probably would call for an outline for the line trace width)

You could either build trilists (triangle lists) instead to have full control of the facets (cant be much harder than the data setup for tristrip - just more data to be built -- 3 points for every triangle making of the rectangles making up your line segments)

Or add color attribute to the vertex data and add a few dummy segments with the coloring turned off alpha 0 when you realign back to the start of the
next of the 3 line traces. Make a coupla dummy color off triangles with the last point defining a trace line and then several more at the startposition of the first point of the next trace then turn the color back on in the points and add the next traces data into the same vertext buffer.

Share this post


Link to post
Share on other sites
I should put sample code to show what I am doing:
Vertex parallelPointsUp[101];
Vertex points[101];
Vertex parallelPointsDown[101];

for (int l = 0; l <= 100; l++)
{
calculate a bezier point and then a point on either side of it
}

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, parallelPointsUp);
glDrawArrays(GL_LINE_STRIP, 0, 100);

glVertexPointer(3, GL_FLOAT, 0, parallelPointsDown);
glDrawArrays(GL_LINE_STRIP, 0, 100);

glVertexPointer(3, GL_FLOAT, 0, points);
glDrawArrays(GL_LINE_STRIP, 0, 100);

glDisableClientState(GL_VERTEX_ARRAY);

I just don't like have three arrays of 100 points. Any idea how too make it look better?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!