plot stick or bars

ok this seems to be easy but not for me …
i have an ordinary x,y vector and i want to draw a stick for every x. or bars x-1,0; x+1,y.

data is so huge so i have to use glDraw functions instead of glVertex or maybe another solution except glVertex2f.

Since the starting points for the bars/sticks (the one on the x-axis) is currently not part of your data you either need to pre-process your vertex data to add in those points (effectively doubling the amount of vertex data) or use a geometry shader to generate the additional points on the fly.

For every input vertex your geometry shader emits two output vertices: the input vertex and one with the same x coordinate, but y == 0.

thanks, im dont know nothing about geometry shader and please tell me little more about it. some simple example maybe? some link helpfull to learn it ?
imm beginner with this and this is a begginer`rs forum :wink: i hope be more my answers here than questions soon.

The wiki has links to tutorials that cover using shaders. Once you are familiar with the basics you can look at e.g. for specifics on geometry shaders.

BTW: typing “opengl geometry shader tutorial” in a search engine produces many useful links…