Hi Ian,

On Thu, Feb 4, 2010 at 10:03 PM, Ian Mallett <geometrian@gmail.com> wrote:
Hi,

So I've been trying to debug some code, and it now occurs to me that PyOpenGL's method of redirecting OpenGL error flags to the console as tracebacks simply isn't working. 

Absolute nonsense goes unchallenged:

glClear(GL_BLEND|GL_TEXTURE_2D)

glViewport(0,0,-800,-600)

glBegin(GL_QUADS)
glClear(GL_DEPTH_BUFFER_BIT)
glEnd()

etc.

I really REALLY need to be aware of opengl errors to debug various problems with framebuffers/shaders/etc.  What's going on?

PyOpenGL 3.0.1b2


I've noticed that you actually need a valid OpenGL context in order to be able to detect gl errors. I modified your example slightly and seems to be throwing errors now:

Negative Viewport dimensions:

>>> import pygame
>>> from OpenGL.GL import *
>>> pygame.init()
(6, 0)
>>> pygame.display.set_mode((100,100), pygame.OPENGL)
<Surface(100x100x32 SW)>
>>> glViewport(0,0,-800,-800)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/OpenGL/error.py", line 194, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1281,
description = 'invalid value',
baseOperation = glViewport,
cArguments = (0, 0, -800, -800)
)
>>> glViewport(0,0,800,800)

Calling glClear between glBegin()...glEnd() block:

>>> glBegin(GL_QUADS)
>>> glClear(GL_DEPTH_BUFFER_BIT)
>>> glEnd()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/OpenGL/GL/exceptional.py", line 55, in glEnd
    return simple.glEnd( )
  File "/usr/lib/python2.5/site-packages/OpenGL/error.py", line 194, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1282,
description = 'invalid operation',
baseOperation = glEnd,
cArguments = ()
)

Let me know how it goes.

Best regards,
Alejandro.-


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Users mailing list
PyOpenGL-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyopengl-users