i am a cinder newbie. My goal is to display some anti-aliased circles and lines using the
GPU.
I looked at the tutorials https://www.libcinder.org/docs/guides/opengl
and derived following code which is intended to be a reduced to the minimum
starting point (draw one circle). It does not show anything though.
I do not know what i am missing here. A hint would be nice.
(As well as a hint on how to implement the anti-aliasing, if possible.
I know this tutorial but cannot translate it to cinder https://rubendv.be/blog/opengl/drawing-antialiased-circles-in-opengl/)
your camera is positioned at (10, 10, 0), looking at (0, 0, 0). Your circle is drawn in the XY-plane. So you’re looking at the side of the flat circle, which is infinitely thin, so you won’t be able to see it. Try this instead:
mCam.lookAt( vec3( 0, 0, 10 ), vec3( 0 ) );
With that being said, you don’t really need a 3D camera when drawing circles. Circles are flat, 2D objects and, by default, Cinder is setup to draw in 2D with the origin (0, 0) at the upper left corner of the window. Disable the call to gl::setMatrices( mCam ); to see what I mean.
As @balachandran_c pointed out, you can enable multi-sampling using RendererGl::Options().msaa(...). You could also render to a multi-sampled frame buffer object (Fbo) when you create it using gl::Fbo::Format().samples( 16 ). The advanced anti-aliasing found in the PostProcessingAA sample is called FXAA and SMAA, which can be used instead of a multi-sampled Fbo, for instance when using an advanced deferred rendering pipeline. It can not be used with the main buffer. I would advice to simply start with RendererGl::Options().msaa(16) until you have learned more about graphics programming.
-Paul
P.S.: kudo’s for using a batch to render your circle. It is faster than `gl::drawSolidCircle()```.