How to draw a moving function graph with OpenGl?

后端 未结 2 1591
星月不相逢
星月不相逢 2021-02-10 02:04

I\'m using OpenGl to animate a graph that looks something like this: \"enter

Here\'s the

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-10 02:19

    You need to sample the function you want to plot.

    glBegin(GL_LINE_STRIP);
    glVertex2f(0f, 0f);
    for (float x = 1f; x < 100f; x += 1f)
      glVertex2f(x, randVarGen());
    glVertex2f(100f, 0f);
    glEnd();
    

提交回复
热议问题