I need to use OpenGL in Java (JOGL library) to draw this figure:

alt text

Known x . "To spoil" the area under this shape is impossible I don’t know OpenGL at all, for every step I’m watching a tutorial or google. But I can not find it. It is even incomprehensible to me, it is necessary to consider it as part of a circle (this is not a sector, but what is it called then?) Or as an area bounded by a straight line and a curve.

PS If you know the answer to Objective Pascal or C ++, write too. There all methods are the same, just wrapped in Java.

    1 answer 1

    Drawing ellipses is a known problem for 3d graphics.

    In the general case, an ellipse can be emulated by some set of triangles folded into the corresponding strip . For example, place the vertices on the sides of the sine and cosine, respectively.

    In your case, I guess it makes sense to take a texture with an alpha channel and draw it on a canvas of four vertices (0,0), (0, 1), (1, 1), (1, 0) . At the same time, if you make the texture large enough and include the appropriate texture sampling , then there will be no artifacts during compression, and everything will look good enough.

    • And I in one part of this kursovik need that such a semicircle be also voluminous. Well, that is type part of the cylinder. Is this really quite difficult? Here's another answer to the same topic: OpenGL — ES 1.0 2d rounded rectangle — angry