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: