toss-dev

07-01-2016, 01:47 PM

Hi, I have already used both geometry shaders and instanced rendering in some applications, but I was wondering if I could mix them

- Basically, I would like to create a generic line rendering system, where I simply push vertices (vec3 position, vec4 color) to a buffer, and draw several lines in a single draw call (if 0, 1, 2, ..., n are the vertices index, I would like to draw lines between (0, 1), (2, 3), ...., but not (1, 2), (3, 4) ...)

- I think I can do it with a 'line VAO', which would hold two vertices : ((0, 0, 0), (0, 0, 1)) , draw instancely and apply a different transformation matrix in each instance.

The VAO method would lead to many calculation cpu-side, to process the transformation matrix for each line: distance between the two points (line model scaling), angle between the standart model and the line (rotation), translate the model to the line origin

I would like to skip those calculation with a geometry shader, as coordinates are already 'world-relative' CPU-side

I hope it made sense and English was correct, maybe I'm searching the wrong way, so feel free to give me alternative solution. Thank you for your reading

- Basically, I would like to create a generic line rendering system, where I simply push vertices (vec3 position, vec4 color) to a buffer, and draw several lines in a single draw call (if 0, 1, 2, ..., n are the vertices index, I would like to draw lines between (0, 1), (2, 3), ...., but not (1, 2), (3, 4) ...)

- I think I can do it with a 'line VAO', which would hold two vertices : ((0, 0, 0), (0, 0, 1)) , draw instancely and apply a different transformation matrix in each instance.

The VAO method would lead to many calculation cpu-side, to process the transformation matrix for each line: distance between the two points (line model scaling), angle between the standart model and the line (rotation), translate the model to the line origin

I would like to skip those calculation with a geometry shader, as coordinates are already 'world-relative' CPU-side

I hope it made sense and English was correct, maybe I'm searching the wrong way, so feel free to give me alternative solution. Thank you for your reading