beproudstandupcom / pyglet

Automatically exported from code.google.com/p/pyglet
0 stars 0 forks source link

pyglet.gl.ContextException: No conforming visual exists #130

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install pyglet
2. See traceback

Paste in the traceback or error message:
$ python
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35) 
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyglet import window
>>> win = window.Window()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pyglet/window/__init__.py", line
579, in __init__
    config = screen.get_best_config(config)
  File "/usr/lib/python2.5/site-packages/pyglet/window/__init__.py", line
308, in get_best_config
    configs = self.get_matching_configs(template)
  File "/usr/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 225, in get_matching_configs
    return [config_class(self, attrib_list)]
  File "/usr/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 280, in __init__
    raise gl.ContextException('No conforming visual exists')
pyglet.gl.ContextException: No conforming visual exists
>>> 

Paste in the output of tools/gl_info.py:
$ python tools/gl_info.py 
Platform instance is <pyglet.window.xlib.XlibPlatform object at 0x82b7a6c>
Display instance is <pyglet.window.xlib.XlibDisplayDevice object at 0xb7d0d9ec>
Screens:
  XlibScreen(screen=0, x=0, y=0, width=1280, height=1024, xinerama=0)
Creating default context...
Traceback (most recent call last):
  File "tools/gl_info.py", line 25, in <module>
    w = pyglet.window.Window(1, 1, visible=True)
  File "/usr/lib/python2.5/site-packages/pyglet/window/__init__.py", line
579, in __init__
    config = screen.get_best_config(config)
  File "/usr/lib/python2.5/site-packages/pyglet/window/__init__.py", line
308, in get_best_config
    configs = self.get_matching_configs(template)
  File "/usr/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 225, in get_matching_configs
    return [config_class(self, attrib_list)]
  File "/usr/lib/python2.5/site-packages/pyglet/window/xlib/__init__.py",
line 280, in __init__
    raise gl.ContextException('No conforming visual exists')
pyglet.gl.ContextException: No conforming visual exists

Any additional info (platform/language/hardware) that may be relevant?
I had the same problem on Python 2.4
I'm using Ubuntu 7.04
I had the same problem with both pyglet svn and pyglet 1.0 alpha 2

Original issue reported on code.google.com by nek...@gmail.com on 20 Aug 2007 at 6:07

GoogleCodeExporter commented 9 years ago
Someone else had this problem too. Go to 
http://www.pyweek.org/e/ambling/ratings/ and
search the page for "No conforming visual exists"

Original comment by nek...@gmail.com on 20 Aug 2007 at 6:09

GoogleCodeExporter commented 9 years ago
(Lots of people have had this problem, it's mostly a matter of finding the 
particular workaround for your 
hardware/driver...)

Can you attach the output of glxinfo, and your Xorg.conf file if it's no 
problem?

Original comment by Alex.Hol...@gmail.com on 20 Aug 2007 at 7:42

GoogleCodeExporter commented 9 years ago
Attached

Original comment by nek...@gmail.com on 20 Aug 2007 at 3:03

Attachments:

GoogleCodeExporter commented 9 years ago
This is related to issue 19.  AFAIK no-one else has evaluated pyglet in 16-bit 
color.  We're not doing anything to 
explicitly disable it, but I've not looked into the problem much.  Any help 
from those with similar setups & time 
would be appreciated.

Original comment by Alex.Hol...@gmail.com on 21 Aug 2007 at 12:14

GoogleCodeExporter commented 9 years ago
I changed the color depth and it works perfectly now, thanks.

I ran `gksudo gedit /etc/X11/xorg.conf`, 
replaced "DefaultDepth  16" with "DefaultDepth  24", 
then restarted and it worked fine.

Original comment by nek...@gmail.com on 21 Aug 2007 at 12:28

GoogleCodeExporter commented 9 years ago
I realised on the train that the problem was probably the depth buffer, not the 
color
buffer.  By default pyglet requests a depth size of 24, but with a 16-bit 
display
only 16-bit depth buffers are available.  If you (or someone else) can confirm 
that
the following works on a 16-bit display, I'll add fallback code for the default 
case::

from pyglet import gl
from pyglet import window

config = gl.Config(depth_size=16)
w = window.Window(config=config)
while not w.has_exit:
    w.dispatch_events()
    w.clear()
    w.flip()

Original comment by Alex.Hol...@gmail.com on 21 Aug 2007 at 2:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The code you gave me appears to work fine, but with slight modification, it 
fails to
work correctly. When I try to draw an image, it flickers. The image basically 
appears
as a series of horizontal bars. I tried taking a few screenshots and all but one
turned out as a black screen. The only one that had the image on it had about 
half of
the image (the top half). I tried it with both vsync on and off, with the same
results both ways. Here's the code I'm using:

######

from pyglet import gl
from pyglet import window
from pyglet import image

config = gl.Config(depth_size=16)
w = window.Window(200, 200, config=config)
im = image.load("test.png")
while not w.has_exit:
    w.dispatch_events()
    w.clear()
    im.blit(50, 50)
    w.flip()

######

Kind of off topic, but for now I strongly suggest giving a more descriptive 
error
message that tells the user that they need 24 or higher.

Original comment by nek...@gmail.com on 21 Aug 2007 at 4:32

Attachments:

GoogleCodeExporter commented 9 years ago
The window is single buffered, so w.flip() has no effect (the equivalent for 
single
buffers is glFinish), causing the flickering.  The solution is to add a back 
buffer
by specifying the Config as::

config = gl.Config(depth_size=16, double_buffer=True)

Original comment by Alex.Hol...@gmail.com on 21 Aug 2007 at 2:55

GoogleCodeExporter commented 9 years ago
Oh, sorry about that.

Original comment by nek...@gmail.com on 21 Aug 2007 at 3:02

GoogleCodeExporter commented 9 years ago
Implemented in r1195: fallback to 16-bit depth if 24-bit is not available.

Original comment by Alex.Hol...@gmail.com on 24 Aug 2007 at 9:39