Skip to content

Commit

Permalink
Allow for passing unicode strings to GLUT functions which expect bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfletch committed Jul 11, 2013
1 parent a02d373 commit fb58787
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion OpenGL/raw/GLUT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from OpenGL.raw.GLUT.constants import *

from ctypes import *
from OpenGL._bytes import unicode
from OpenGL import platform, arrays
from OpenGL.constant import Constant
from OpenGL import constants as GLconstants
Expand All @@ -17,7 +18,12 @@
else:
CALLBACK_FUNCTION_TYPE = platform.PLATFORM.functionTypeFor( platform.GLUT )

STRING = c_char_p
class STRING( c_char_p ):
@classmethod
def from_param( cls, value ):
if isinstance( value, unicode ):
value = value.encode( 'utf-8' )
return super( STRING, cls ).from_param( value )
from OpenGL.constants import GLenum
from OpenGL.constants import GLfloat
from OpenGL.constants import GLdouble
Expand Down

0 comments on commit fb58787

Please sign in to comment.