Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Buffers Are Interfering With Each Other; glReadPixels fails

  1. #1
    Newbie Newbie
    Join Date
    Jun 2017
    Posts
    2

    Unhappy Buffers Are Interfering With Each Other; glReadPixels fails

    I have an application in a GUI made in wx.Python. I'm rendering graphics with gl* calls, on wx.glcanvas instances.

    I init() them like so:
    glcanvas.GLCanvas.__init__(self, parent, -1)

    get their contexts:
    self.context = glcanvas.GLContext(self)

    set their contexts in OnPaint():
    self.SetCurrent(self.context)

    So, when I only have one glcanvas, everything works fine. But I want to have multiple canvases, rendering different things in the GUI. Their contexts and buffers seem to be interfering with each other, though. I get a lot of issues, most of the time I've been able to 'band aid' over them. But I'm trying to access pixels in the back buffer in one of my canvases, and now I can't do this, since adding the other canvas to the program. Just wondering if anyone has any experience with these issues? Has anyone rendered on multiple windows or canvases in Py.OpenGL? I believe the buffers are messed up, which is causing the exception thrown from GL\images.py.

    My exception details:
    ArgumentError: argument 7: <type 'exceptions.TypeError'>: wrong type

    pixelRed = glReadPixels(x, viewport[3] - y, 1, 1, GL_RED, GL_BYTE)[0][0]
    File "C:\Python27\lib\site-packages\OpenGL\GL\images.py", line 362, in glReadPixels
    imageData


    this function that throws this is in images.py,
    GL_1_1.glReadPixels(
    x,y,width,height,
    format,type,
    imageData
    )

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,404
    Quote Originally Posted by granters View Post
    Has anyone rendered on multiple windows or canvases in Py.OpenGL?
    Yes. Here's an example program using wxPython and PyOpenGL. The contexts aren't sharing data.

  3. #3
    Newbie Newbie
    Join Date
    Jun 2017
    Posts
    2
    Quote Originally Posted by GClements View Post
    Yes. Here's an example program using wxPython and PyOpenGL. The contexts aren't sharing data.
    This is a great example, thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •