View Full Version : The nature of GL_POINT

04-05-2011, 03:03 AM
Being a noobe I have this question. How OpenGL draws the points.Are those (under the hood) still comprised of triangles?
In fact I am asking it in regards to Adobe latest Flash Player 3D release (Molehill API) that gives an access to GPU. The API interfaces the GPU via OpenGL /directX for Mac/PC respectively.However it doesn't allow to draw anything but triangles .So I am curious if OpenGL Gl_POINT is basically a triangle too.
Thank for help.

04-05-2011, 07:32 AM
Older generation of video cards supported points with a pixel size of 1. Under D3D, all you can render is points with size 1. Under GL, for some reason they preferred to offer more, probably because the CAD/DCC industries needed it. Lines were only supported with size 1 under D3D.

I don't know how they coded their drivers but I imagine they would render them as triangles if you asked for size bigger than 1.

Then a new generation of video cards supported point sprites. Therefore it is possible that is used to emulate points with size bigger than 1.

When GL 3.0 was introduced, it was suppose to be straight to the metal API. Just like D3D, line size was 1. I don't remember for points.
GL 3.1 changed back.

Anyway, why does it matter to you?

04-05-2011, 08:14 AM
you can't have line sizes of anything other than 1.0 in opengl 3.0 ?

04-05-2011, 01:31 PM
No. OpenGL 3.0 tried to do away everything that could be "difficult" to support.

I am not sure, if points are really rendered as triangles, because contrary to triangles, points are ALWAYS rasterized, whereas triangles can become too small to be rasterized.

I think it would actually be easier to program the hardware to use a special code-path to render points, than to generate triangles in a way that guarantees for points to be rasterized.

But honestly to the end user (the GL programmer) those details do not matter, at all.


04-05-2011, 01:44 PM
But honestly to the end user (the GL programmer) those details do not matter, at all.

This, basically.

I would actually hazard a guess that different drivers do it different ways, and that OpenGL itself neither prescribes nor proscribes any specific way, so long as the end result satisfies conformance and invariance rules. But I haven't honestly read that part of the spec so it remains a guess.

Alfonse Reinheart
04-05-2011, 02:30 PM
you can't have line sizes of anything other than 1.0 in opengl 3.0 ?

Point sizes still exist in core 3.2 and above. But they are always controlled by the shader. You can't set them from code. Well, not unless your shader takes an attribute/uniform that it sets the point size to. So if you want to set shaders from code, you have to write a shader that takes a value from code and sets the point size to it.

04-06-2011, 01:22 AM
Thanks for the answers guys.The reason I want to know how GL_POINT is drawn is for writing a point primitive for Adobe Flash 3D [Molehill] environment that I mentioned above.As I have said ,Molehill API doesn't allow draw anything but triangle. And because it interfaces GPU via OpenGL/Direct3D I am curious why they don't supply an ability to draw lines and point(the question is directed to Adobe of course ) .Therefore I seek a workaround to create points in 3D.As it looks to me now I will have to draw small point like prims with several triangles.

04-07-2011, 02:12 AM
If you have a look at any diagram which shows the OpenGL pipeline, after the vertex processors you have primitive assembly, which takes the end transformed vertices and generates primitives (points, lines, triangles, etc). Using interpolation, it will then shade each fragment with the fragment processor. Take a guess into how legacy OpenGL shaded point primitives. Modern OpenGL treats each point as a PointSprite, so it will be rendered as a textured quad.

// fragment shader
fragColour = texture2D(uTextureUnit0, gl_PointCoord);