@@ -172,9 +172,7 @@ def tkSwapBuffers( self ):
172172if sys .platform .startswith ( 'linux' ):
173173
174174 from ctypes import c_int , c_char_p , c_void_p , cdll , POINTER
175- from OpenGL .GLX import GLX_RGBA , GLX_DOUBLEBUFFER , GLX_RED_SIZE , \
176- GLX_BLUE_SIZE , GLX_GREEN_SIZE , GLX_DEPTH_SIZE , glXChooseVisual , \
177- glXMakeCurrent , glXCreateContext , glXSwapBuffers
175+ from OpenGL import GLX
178176 from OpenGL .raw ._GLX import Display
179177
180178 _x11lib = cdll .LoadLibrary ('libX11.so' )
@@ -184,34 +182,39 @@ def tkSwapBuffers( self ):
184182
185183 Colormap = c_void_p
186184
187- att = [ GLX_RGBA , GLX_DOUBLEBUFFER ,
188- GLX_RED_SIZE , 4 ,
189- GLX_GREEN_SIZE , 4 ,
190- GLX_BLUE_SIZE , 4 ,
191- GLX_DEPTH_SIZE , 16 ,
192- GL . GLint ( 0 ) ,
185+ att = [ GLX . GLX_RGBA , GLX . GLX_DOUBLEBUFFER ,
186+ GLX . GLX_RED_SIZE , 4 ,
187+ GLX . GLX_GREEN_SIZE , 4 ,
188+ GLX . GLX_BLUE_SIZE , 4 ,
189+ GLX . GLX_DEPTH_SIZE , 16 ,
190+ 0 ,
193191 ]
194192
195193 # Inherits the base and fills in the 3 platform dependent functions
196194 class OpenGLFrame ( baseOpenGLFrame ):
197195
198196 def tkCreateContext ( self ):
199197 self .__window = XOpenDisplay ( os .environ .get ("DISPLAY" ) )
200- visual = glXChooseVisual ( self .__window , 0 ,
198+ major = c_int (0 )
199+ minor = c_int (0 )
200+ GLX .glXQueryVersion ( self .__window , major , minor )
201+ print ("GLX version:" ,major ,minor )
202+ visual = GLX .glXChooseVisual ( self .__window , 0 ,
201203 (GL .GLint * len (att ))(* att ) )
202204 if not visual :
203205 _log .error ("glXChooseVisual call failed" )
204- self .__context = glXCreateContext (self .__window , visual , None ,
205- GL .GL_FALSE )
206- glXMakeCurrent (self .__window , self ._wid , self .__context )
206+ self .__context = GLX .glXCreateContext (self .__window , visual ,
207+ None ,
208+ GL .GL_TRUE )
209+ GLX .glXMakeCurrent (self .__window , self ._wid , self .__context )
207210
208211 def tkMakeCurrent ( self ):
209212 if self .winfo_ismapped ():
210- glXMakeCurrent (self .__window , self ._wid , self .__context )
213+ GLX . glXMakeCurrent (self .__window , self ._wid , self .__context )
211214
212215 def tkSwapBuffers ( self ):
213216 if self .winfo_ismapped ():
214- glXSwapBuffers ( self .__window , self ._wid )
217+ GLX . glXSwapBuffers ( self .__window , self ._wid )
215218
216219# Linux/X11 specific code ends
217220###############################################################################
0 commit comments