OpenGL Breshenem algorithm drawing circle

I can draw a circle using an algorithm. However, the border looks strange, the pixels look so separate from each other. I want them closer. I tried to increase the size of the point. But the result is not so good. So, I thought that maybe it would be better if I could completely fill the pixel. (I suppose it's square.) How do I do this or do you have an idea? Now it looks like this: http://img690.imageshack.us/i/circlev.jpg/

Thank you in advance.

+3
source share
3 answers

Without code, it is difficult to diagnose the problem. The actual pixel layout looks correct for this algorithm. It looks like you are using a projection matrix that does not translate the space of the world directly onto the screen space.

Try using spelling projection, where you can make sure that one offset in world coordinates costs exactly one pixel on the screen.

+5
source

Judging by your jpeg, I am wondering if what you think is really one pixel in world space is actually not. Perhaps your projection matrix is ​​not doing what you think.

Is GL_POINT_SMOOTH enabled? β€œMaybe it's messing with things.” These pixels look weird.

, ( , ), "" GL_POINTS.

+2

use the sin / cos method, then you can draw lines from one point to another, it also allows you to change the details of a polygon, not to mention that it is much easier to fill a circle, and then (draw triangles from the middle to the edges).

If you use more detailed information, the result will be almost the same as that of Bresenham.

0
source

Source: https://habr.com/ru/post/1795231/


All Articles