cledio66 / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

"pyglet.gl.lib.GLException: stack underflow" when a second pyglet app is opened or closed #385

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Just started using pyglet and love what I am seeing, excellent work!

I stumbled across this issue while running the examples.

Steps to reproduce the problem:
1. Run the media_player.py example with any song
2. While media_player.py is running, run the graphics.py example

Sometimes the media_player example will throw a GLException (stack
underflow) when calling glPopAttrib() while the graphics.py example is
being opened (or closed). I suspect that it is some sort of race condition
in OpenGL (in this case, while the media_player labels are being drawn). I
can usually get it to happen after opening and closing graphics.py between
2-6 times (not necessarily in quick succession).

Traceback (most recent call last):
  File "media_player.py", line 330, in <module>
    pyglet.app.run()
  File "/pyglet-1.1.2/pyglet/app/__init__.py", line 264, in run
    EventLoop().run()
  File "/pyglet-1.1.2/pyglet/app/xlib.py", line 94, in run
    sleep_time = self.idle()
  File "/pyglet-1.1.2/pyglet/app/__init__.py", line 193, in idle
    window.dispatch_event('on_draw')
  File "/pyglet-1.1.2/pyglet/window/__init__.py", line 1217, in dispatch_event
    EventDispatcher.dispatch_event(self, *args)
  File "/pyglet-1.1.2/pyglet/event.py", line 349, in dispatch_event
    getattr(self, event_type)(*args)
  File "media_player.py", line 309, in on_draw
    control.draw()
  File "media_player.py", line 82, in draw
    self.draw_label()
  File "media_player.py", line 107, in draw_label
    self._text.draw()
  File "/pyglet-1.1.2/pyglet/text/layout.py", line 834, in draw
    self.batch.draw()
  File "/pyglet-1.1.2/pyglet/graphics/__init__.py", line 538, in draw
    func()
  File "/pyglet-1.1.2/pyglet/text/layout.py", line 527, in unset_state
    glPopAttrib()
  File "/pyglet-1.1.2/pyglet/gl/lib.py", line 105, in errcheck
    raise GLException(msg)
pyglet.gl.lib.GLException: stack underflow

pyglet 1.1 with Python 2.5: Paste in the output of `python -m pyglet.info`
Other: Paste in the output of tools/gl_info.py (included in source distro):

$ python2.5 -m pyglet.info
Python
------------------------------------------------------------------------------
sys.version: 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
sys.platform: linux2
os.getcwd(): /pyglet-1.1.2/examples

pyglet
------------------------------------------------------------------------------
pyglet.version: 1.1.2
pyglet.__file__: /pyglet-1.1.2/pyglet/__init__.pyc
pyglet.options['debug_trace_depth'] = 1
pyglet.options['audio'] = ('directsound', 'openal', 'alsa', 'silent')
pyglet.options['xsync'] = True
pyglet.options['debug_trace_flush'] = True
pyglet.options['debug_win32'] = False
pyglet.options['debug_gl_trace'] = False
pyglet.options['debug_x11'] = False
pyglet.options['shadow_window'] = True
pyglet.options['debug_font'] = False
pyglet.options['debug_media'] = False
pyglet.options['debug_trace'] = False
pyglet.options['debug_lib'] = False
pyglet.options['graphics_vbo'] = True
pyglet.options['vsync'] = None
pyglet.options['debug_trace_args'] = False
pyglet.options['debug_gl'] = True
pyglet.options['debug_graphics_batch'] = False
pyglet.options['font'] = ('gdiplus', 'win32')
pyglet.options['debug_texture'] = False
pyglet.options['debug_gl_trace_args'] = False

pyglet.window
------------------------------------------------------------------------------
platform: <pyglet.window.xlib.XlibPlatform object at 0x845472c>
display: <pyglet.window.xlib.XlibDisplayDevice object at 0x844d60c>
screens[0]: XlibScreen(screen=0, x=0, y=1050, width=1440, height=900,
xinerama=1)
screens[1]: XlibScreen(screen=0, x=0, y=0, width=1680, height=1050, xinerama=1)
config['double_buffer'] = 1
config['stereo'] = 0
config['buffer_size'] = 24
config['aux_buffers'] = 0
config['sample_buffers'] = 0
config['samples'] = 0
config['red_size'] = 8
config['green_size'] = 8
config['blue_size'] = 8
config['alpha_size'] = 0
config['depth_size'] = 16
config['stencil_size'] = 0
config['accum_red_size'] = 0
config['accum_green_size'] = 0
config['accum_blue_size'] = 0
config['accum_alpha_size'] = 0
context: XlibGLContext()

pyglet.gl.gl_info
------------------------------------------------------------------------------
gl_info.get_version(): 1.4 (2.1 Mesa 7.0.3-rc2)
gl_info.get_vendor(): Mesa project: www.mesa3d.org
gl_info.get_renderer(): Mesa GLX Indirect
gl_info.get_extensions():
   GL_APPLE_packed_pixels
   GL_ARB_depth_texture
   GL_ARB_draw_buffers
   GL_ARB_fragment_program
   GL_ARB_imaging
   GL_ARB_multisample
   GL_ARB_multitexture
   GL_ARB_occlusion_query
   GL_ARB_point_parameters
   GL_ARB_point_sprite
   GL_ARB_shadow
   GL_ARB_shadow_ambient
   GL_ARB_texture_border_clamp
   GL_ARB_texture_compression
   GL_ARB_texture_cube_map
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_crossbar
   GL_ARB_texture_env_dot3
   GL_ARB_texture_mirrored_repeat
   GL_ARB_texture_non_power_of_two
   GL_ARB_texture_rectangle
   GL_ARB_transpose_matrix
   GL_ARB_vertex_program
   GL_ARB_window_pos
   GL_ATIX_texture_env_combine3
   GL_ATI_draw_buffers
   GL_ATI_texture_env_combine3
   GL_ATI_texture_mirror_once
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_equation_separate
   GL_EXT_blend_func_separate
   GL_EXT_blend_logic_op
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_clip_volume_hint
   GL_EXT_copy_texture
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_framebuffer_object
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_pixels
   GL_EXT_paletted_texture
   GL_EXT_point_parameters
   GL_EXT_polygon_offset
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_shared_texture_palette
   GL_EXT_stencil_wrap
   GL_EXT_subtexture
   GL_EXT_texture
   GL_EXT_texture3D
   GL_EXT_texture_edge_clamp
   GL_EXT_texture_env_add
   GL_EXT_texture_env_combine
   GL_EXT_texture_env_dot3
   GL_EXT_texture_lod_bias
   GL_EXT_texture_mirror_clamp
   GL_EXT_texture_object
   GL_EXT_texture_rectangle
   GL_EXT_vertex_array
   GL_IBM_texture_mirrored_repeat
   GL_INGR_blend_func_separate
   GL_MESA_pack_invert
   GL_MESA_ycbcr_texture
   GL_NV_blend_square
   GL_NV_fragment_program
   GL_NV_light_max_exponent
   GL_NV_point_sprite
   GL_NV_texgen_reflection
   GL_NV_texture_rectangle
   GL_NV_vertex_program
   GL_NV_vertex_program1_1
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_border_clamp
   GL_SGIS_texture_edge_clamp
   GL_SGIS_texture_lod
   GL_SGIX_depth_texture
   GL_SGIX_shadow
   GL_SGIX_shadow_ambient
   GL_SGI_color_matrix
   GL_SGI_color_table
   GL_SUN_multi_draw_arrays

pyglet.gl.glu_info
------------------------------------------------------------------------------
glu_info.get_version(): 1.3
glu_info.get_extensions():
   GLU_EXT_nurbs_tessellator
   GLU_EXT_object_space_tess

pyglet.gl.glx_info
------------------------------------------------------------------------------
context.is_direct(): 0
glx_info.get_server_vendor(): SGI
glx_info.get_server_version(): 1.2
glx_info.get_server_extensions():
   GLX_ARB_multisample
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_EXT_import_context
   GLX_EXT_texture_from_pixmap
   GLX_OML_swap_method
   GLX_SGI_make_current_read
   GLX_SGIS_multisample
   GLX_SGIX_hyperpipe
   GLX_SGIX_swap_barrier
   GLX_SGIX_fbconfig
   GLX_MESA_copy_sub_buffer
glx_info.get_client_vendor(): SGI
glx_info.get_client_version(): 1.4
glx_info.get_client_extensions():
   GLX_ARB_get_proc_address
   GLX_ARB_multisample
   GLX_EXT_import_context
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_MESA_allocate_memory
   GLX_MESA_swap_control
   GLX_MESA_swap_frame_usage
   GLX_OML_swap_method
   GLX_OML_sync_control
   GLX_SGI_make_current_read
   GLX_SGI_swap_control
   GLX_SGI_video_sync
   GLX_SGIS_multisample
   GLX_SGIX_fbconfig
   GLX_SGIX_pbuffer
   GLX_SGIX_visual_select_group
   GLX_EXT_texture_from_pixmap
glx_info.get_extensions():
   GLX_ARB_get_proc_address
   GLX_ARB_multisample
   GLX_EXT_import_context
   GLX_EXT_visual_info
   GLX_EXT_visual_rating
   GLX_OML_swap_method
   GLX_SGI_make_current_read
   GLX_SGIS_multisample
   GLX_SGIX_fbconfig
   GLX_EXT_texture_from_pixmap

pyglet.media
------------------------------------------------------------------------------
driver: pyglet.media.drivers.openal

pyglet.media.avbin
------------------------------------------------------------------------------
Library: <CDLL 'libavbin.so', handle 86311c0 at 8642a8c>
AVbin version: 7
FFmpeg revision: 13661

pyglet.media.drivers.openal
------------------------------------------------------------------------------
Library: <CDLL 'libopenal.so.0', handle 8604eb0 at 8593fec>
Version: (1, 0)
Extensions:

   weird vorbid_get

Original issue reported on code.google.com by jasonwy...@gmail.com on 20 Jan 2009 at 2:55

GoogleCodeExporter commented 9 years ago
Assuming you're running the two examples in separate processes (i.e., not using 
something like IDLE that 
doesn't fork), this is a bug in your OpenGL driver.  It is the driver's 
responsibility to provide a concurrency-safe 
interface to contexts per process.

Original comment by Alex.Hol...@gmail.com on 20 Jan 2009 at 11:46