Question

I want to animate my GL_LINE_STRIP vertex by vertex. Here is how I do it now (inefficiently):

void renderFunc()
{
 glDrawElements(GL_LINE_STRIP, testCount, GL_UNSIGNED_INT, (GLvoid*)0);

if ( testCount < verts.size() )
    testCount++;
}

However, it must completely redraw vertices, because it draws from the beginning as opposed to from where it left off, which takes extra time. I'd like to try and draw one vertex at a time to speed things up, unless there are other ideas.

Was it helpful?

Solution

Just don't clear your render target. In case, where you are drawing to back buffer, remove those functions:

glClearColor(...);
glClear(GL_COLOR_BUFFER_BIT);

(if you rendering to any other target, you already know how to do it ;) )

Consider also leaving depth /stencil buffers uncleared:

`GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT`


But wait, is performance really so bad, that you gonna let a hairy mess been drawn up?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top