How to draw a dynamic line?

I want to draw a line in OpenGL that will get new points very often. I want to achieve that the object draws a line behind it.

enter image description here

So I have to make an array and add all the new points to it (BufferData is set to GL_DYNAMIC_DRAW). And then redraw the line using glDrawArrays. Tessellation + stroke width will be inside the top?

Or is there a better way?

+4
source share
1 answer

Good evening:)

. : , . , . 2 , .

, , .

OpenGl

gl.glBufferData(gl.GL_ARRAY_BUFFER, 8 * self.maxPoints, None, gl.GL_DYNAMIC_DRAW)
# 8 bytes 2 points = 1 plot
# maxPoints amount of max plots

2 (gl.glBufferSubData). ? ? :

Sketch

( wasd):

With wireframe on

large time delay

slight delay

+2

Source: https://habr.com/ru/post/1614773/


All Articles