View Full Version : plot stick or bars
04-24-2012, 02:28 PM
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.
04-24-2012, 04:12 PM
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.
04-25-2012, 01:04 PM
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 ;) i hope be more my answers here than questions soon.
04-25-2012, 02:47 PM
The wiki (http://www.opengl.org/wiki/Getting_started) has links to tutorials that cover using shaders. Once you are familiar with the basics you can look at e.g. http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/geometry-shader/ for specifics on geometry shaders.
BTW: typing "opengl geometry shader tutorial" in a search engine produces many useful links...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.