#226 glColor wrapper doesn't handle tuple of floats properly

closed-fixed
GL (74)
5
2010-02-22
2010-01-25
Anonymous
No

In the following fragment of exceptional.py

Either GLdoubleArray should be used or colorDispatch should refer to glColorXfv not glColorXdv. In simpler words types should match or there is no effect to glColor call

colorDispatch = {
3: annotations.glColor3dv,
4: annotations.glColor4dv,
}

def glColor( *args ):
"""glColor*f* -- convenience function to dispatch on argument type
dispatches to glColor3f, glColor2f, glColor4f, glColor3f, glColor2f, glColor4f
depending on the arguments passed...
"""
arglen = len(args)
if arglen == 1:
arg = arrays.GLfloatArray.asArray( args[0] )
function = glColorDispatch[arrays.GLfloatArray.arraySize( arg )]
return function( arg )
elif arglen == 2:
return simple.glColor2d( *args )
elif arglen == 3:
return simple.glColor3d( *args )
elif arglen == 4:
return simple.glColor4d( *args )
else:
raise ValueError( """Don't know how to handle arguments: %s"""%(args,))

Tested on Gentoo linux,
PyOpengl 3.0.1_beta1 and beta2
Python 2.6.4

email: dedkov@gmail.com

Discussion

    • status: open --> closed
     
  • Revision 346 in bzr should fix this.

     
    • status: closed --> closed-fixed