0

I've already asked this question here as it is in the context of Blender. But I hope to find a larger audience in stackoverflow to answer this question.

I'm doing the following using bgl which is a Python wrapper for OpenGL.

I am surely missing something (an initialization or other). Any clue will be a great help. Thanks.

The drawing is done on a 2D buffer.

Here is the code before the drawing:

bgl.glDisable( bgl.GL_SCISSOR_TEST )
bgl.glViewport( 0, 0, imageWidth, imageHeight )

bgl.glMatrixMode( bgl.GL_PROJECTION )
bgl.glLoadIdentity()
bgl.gluOrtho2D( 0, imageWidth, 0, imageHeight )
bgl.glEnable( bgl.GL_TEXTURE_2D )

Then:

    bgl.glClearColor( *defaultColor, 0 )
    bgl.glClear( bgl.GL_COLOR_BUFFER_BIT | bgl.GL_DEPTH_BUFFER_BIT )

And:

                bgl.glEnable( bgl.GL_POLYGON_SMOOTH )
                bgl.glHint( bgl.GL_POLYGON_SMOOTH_HINT, bgl.GL_NICEST )
                bgl.glBegin( bgl.GL_POLYGON )
                ...

But the result is:

enter image description here

Community
  • 1
  • 1
lemon
  • 336
  • 2
  • 17
  • First of all `glHint` is just a hint, it might not do anything at all. Second of all don't use `GL_POLYGON_SMOOTH` as a solution to do anti-aliasing/multisampling. [Because it sounds like what you want is multisampling.](http://stackoverflow.com/a/42882506/2470818) – vallentin Apr 01 '17 at 16:46
  • @Vallentin, thanks, but two aspects: even in Blender I'm here in a pure 2D drawing (so I just want to draw smooth lines or borders on an image), and the other point is it seems that the wrapper does not allow the operations indicated in your linked answer (or I don't find them) https://docs.blender.org/api/2.78b/bgl.html – lemon Apr 01 '17 at 17:22

0 Answers0