Pyglet OpenGL drawing anti-aliasing

Posted by Jared Forsyth on Stack Overflow See other posts from Stack Overflow or by Jared Forsyth
Published on 2010-04-30T21:21:52Z Indexed on 2010/04/30 21:27 UTC
Read the original article Hit count: 1188

Filed under:
|
|
|
|

I've been looking around for a way to anti-alias lines in OpenGL, but none of them seem to work... here's some example code:

import pyglet                                                                      
from pyglet.gl import *                                                            

window = pyglet.window.Window(resizable=True)                                      

@window.event                                                                      
def on_draw():                                                                     
    window.clear()                                                                 
    pyglet.gl.glColor4f(1.0,0,0,1.0)                                               
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)                             
    glEnable (GL_BLEND)                                                            
    glEnable (GL_LINE_SMOOTH);                                                     
    glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE)                                     
    glLineWidth (3)                                                                
    pyglet.graphics.draw(2, pyglet.gl.GL_LINES,                                    
        ('v2i', (10, 15, 300, 305))                                                
    )                                                                              

pyglet.app.run() 

Can anyone see what I am doing wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about pyglet