0

I am working on an application that has to render a graph 3-dimensionally. Nodes are represented by spheres and in my first draft I just draw glLines as edges.

Now the lines need to be

a) thick lines and

b) as it is a 3d application, they basically must have an cylindrical shape (It would look very weird otherwise).

After reading up on thick lines in OpenGL, I figured that this is relatively complicated, especially given my additional cylindrical shape in 3d requirement.

So I thought "Why not just take a cylinder model, and translate/rotate/scale it in place to represent the edge".

It works fine for me, and also achieves the look I am going for.

As I never saw anything similar online when researching "thick lines in OpenGL" I was wondering if there are any major drawback with my approach?

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
nurgan
  • 53
  • 8
  • You are starting to think in "OpenGL mode". Well done. Forget about "thick lines". – Ripi2 Jul 06 '17 at 18:29
  • If you want to find what you're looking for I suggest you search instead for `volumetric lines in opengl` – Jherico Jul 07 '17 at 14:18

1 Answers1

0

I would use GLSL

  1. pass interpolation polynomial/control points of rendered part of your curve plot

    so divide your plot to chunks, fit polynomial or use cubic interpolation.

  2. render rectangle covering your actually rendered chunk

  3. in fragment

    compute distance of fragment to your curve and either render it (color based on distance) or discard it if more distant then cylinder radius.

Here some related QAs that can help you with your task:

Community
  • 1
  • 1
Spektre
  • 49,595
  • 11
  • 110
  • 380