How to get the coorrdinate lists?

I am wondering whether there is a easy function in OpenGL to get the coordinate lists of points that locate inside a given Polygen? (I am doing ROI things)

Any idea?

Inside any mathematical polygon, there is an infinite number of points.

If you want the coordinates of the pixels of the projected polygon, then say so …


Sounds like you want to do hit detection, I’m not sure ?
In that case, check out glRenderMode (GL_SELECT). The idea is to render only the region of interest (by changing the projection matrix) using a special mode, that doesn’t render anything, but instead reports back to you (see glSelectBuffer) the “names” of the objects you render (specified using glPushName).

If you’re interested in the geometry of the actual fragments being rendered, check out the feedback buffer instead (glFeedbackBuffer, glRenderMode (GL_FEEDBACK).

V-man, coordinates are pixel unit.
No render is required. I just want any
coordinates list inside a polygon.
for example,

inside polygon
I will have (1,1) as the output.

The real polygons may be arbitary shapes
even concave shape.

Any easy function for that? (If you formiliar with MATLAB, you know it is easily
implemented by ‘roipoly’ function.)



there isnt a function in GL that returns the rasterized coordinates, but you can always render your shape, and read the pixel buffer.


That’s the most straighforward method I think.