I wanted to draw the edges and vertices of the triangle, but by accident it took longer to draw than the entire face, and as I understood, the edges and vertices should be easier to draw than the whole face.

If you’re drawing a triangle, GL_FILL is a single operation, GL_POINT and GL_LINE are 3 distinct operations which probably require distinct fragment shader invocations. If the triangles are small and/or the fragment shader is relatively simple, tripling the fixed overheads probably outweighs the fact that filling is O(n^2) versus O(n) for lines and O(1) for points (where n is a measure of the size of the triangle).

Also, the hardware vendors are likely to put more effort into triangle rendering than lines or points, as triangle rendering accounts for the vast majority of usage. The number of people who choose a video card based upon line/point rendering performance is probably a small fraction of one percent.

I’ve learned,Thanks for your reply!

I have another question. I think GL_POINT is single operation while GL_LINE and GL_FILLare 3 distinct operations.GL_POINT does not even need raster replacement, only the model View projection transformation is required.It should be the most efficient.

A triangle is 1 triangle, 3 edges, 3 vertices. `GL_LINE`

draws 3 lines , `GL_POINT`

draws 3 points. It may actually be more as the conversion is applied after clipping. If you’re drawing multiple triangles which share vertices or edges, it’s likely that the point or line will be drawn for each polygon which includes it (so it will be slower than simply rendering with `GL_POINTS`

or `GL_LINES`

).

I also tried to use ‘GL_POINTS’ or ‘GL_LINES’, and the time consumption was still 2~3 times of the original.Is there a better way?

Impossible to say without knowing more details. And even in the ideal case, you’re still up against the fact that triangle filling is the dominant use case and so what the vendors will put the most effort into optimising.

The most incomprehensible thing to me is that drawing points takes so much time. I have tried to use CUDA to implement the Opengl function before, but when I finished rasterization, the time was as long as the whole Opengl process, so I gave up.Just now I tried to draw only point clouds with CUDA, which only took 1/5 of the time to draw triangles in OpengL.

I’ve just made an attempt to store my data as an index.However, I used glDrawArrays to draw points and count to fill in the actual number of points. I found that I could also achieve the function, and the time was greatly reduced, which was only half of that of drawing facets.So if I were to reconstruct the data structure of the dots, if I were to match the dots, and remove the duplicates, it would take me a lot less time to draw the boundary line, right?