I am the beginner of using Modern OpenGL with shaders. I have a program that have that generates many points on screen like 500x500 or 100x100. That works perfectly with VBO and VAO. Here is the code and a video representation of my program:

And now I need to draw ellipses on that generated "seeds". How may I do that with not removing generated mesh?

mmatizz

09-21-2017, 04:10 AM

UPDATE:

Here is the example of effect i would like to have. I dont ask about what alghorithm i need to have, to generate the red ellipses and rects, but i would like to know how i can draw something on that actual screen with that actual mesh.

2482

GClements

09-21-2017, 07:19 PM

Convert the points to rectangles, either client-side or using a geometry shader.

You can use a fragment shader to render a rectangle as an ellipse, e.g.:

if (u*u+v*v>1) discard;

where u and v range from -1 to +1 over the rectangle.

Point sprites could be used, but there's an implementation-dependent upper limit on the size, and that limit isn't required to be larger than a single pixel.