Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Multiple calls to line strip


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 codeman_nz   Members   -  Reputation: 128

Like
0Likes
Like

Posted 08 January 2012 - 03:36 PM

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?

Sponsor:

#2 wodinoneeye   Members   -  Reputation: 336

Like
0Likes
Like

Posted 10 January 2012 - 06:54 AM

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.
--------------------------------------------Ratings are Opinion, not Fact

#3 codeman_nz   Members   -  Reputation: 128

Like
0Likes
Like

Posted 10 January 2012 - 01:37 PM

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?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS