xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #321: frontbuf.patch

File frontbuf.patch, 2.8 KB (added by ahuillet, 8 years ago)

Attached patch works *pretty well* for double buffered mode.

  • src/xpra/gl/gl_window_backing.py

    diff --git a/src/xpra/gl/gl_window_backing.py b/src/xpra/gl/gl_window_backing.py
    index 67f8228..bf89bab 100644
    a b from OpenGL.GL import GL_PROJECTION, GL_MODELVIEW, GL_VERTEX_ARRAY, \ 
    2525    GL_TEXTURE_COORD_ARRAY, GL_UNPACK_ROW_LENGTH, GL_UNPACK_ALIGNMENT, \
    2626    GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_NEAREST, \
    2727    GL_UNSIGNED_BYTE, GL_LUMINANCE, GL_RGB, GL_LINEAR, \
    28     GL_TEXTURE0, GL_TEXTURE1, GL_TEXTURE2, GL_QUADS, \
     28    GL_TEXTURE0, GL_TEXTURE1, GL_TEXTURE2, GL_QUADS, GL_COLOR_BUFFER_BIT, \
     29        GL_FRONT, GL_FRONT_AND_BACK, GL_BACK, \
    2930    glActiveTexture, glTexSubImage2D, \
    3031    glGetString, glViewport, glMatrixMode, glLoadIdentity, glOrtho, \
    3132    glEnableClientState, glGenTextures, glDisable, \
    from OpenGL.GL import GL_PROJECTION, GL_MODELVIEW, GL_VERTEX_ARRAY, \ 
    3334    glTexParameteri, \
    3435    glTexImage2D, \
    3536    glMultiTexCoord2i, glColor3f, \
    36     glTexCoord2i, glVertex2i, glEnd
     37    glTexCoord2i, glVertex2i, glEnd, \
     38        glClear, glDrawBuffer
    3739from OpenGL.GL.ARB.texture_rectangle import GL_TEXTURE_RECTANGLE_ARB
    3840from OpenGL.GL.ARB.vertex_program import glGenProgramsARB, glDeleteProgramsARB, \
    3941    glBindProgramARB, glProgramStringARB, GL_PROGRAM_ERROR_STRING_ARB, GL_PROGRAM_FORMAT_ASCII_ARB
    class GLPixmapBacking(PixmapBacking): 
    127129
    128130    def gl_end(self, drawable):
    129131        if drawable.is_double_buffered():
     132            debug("SWAPPING BUFFERS NOW")
    130133            drawable.swap_buffers()
     134            glClear(GL_COLOR_BUFFER_BIT)
    131135        else:
    132136            glFlush()
    133137        drawable.gl_end()
    class GLPixmapBacking(PixmapBacking): 
    138142        if drawable:
    139143            area = event.area
    140144            try:
     145                glDrawBuffer(GL_FRONT)
    141146                self.render_image(area.x, area.y, area.width, area.height)
     147                glDrawBuffer(GL_BACK)
    142148            finally:
    143                 self.gl_end(drawable)
     149                                drawable.gl_end()
    144150
    145151
    146152    def _do_paint_rgb24(self, img_data, x, y, width, height, rowstride, options, callbacks):
    class GLPixmapBacking(PixmapBacking): 
    158164            glDisable(GL_TEXTURE_RECTANGLE_ARB)
    159165        glActiveTexture(GL_TEXTURE0);
    160166        glEnable(GL_TEXTURE_RECTANGLE_ARB)
     167        glDrawBuffer(GL_FRONT)
    161168
    162169        # Upload data as temporary RGB texture
     170               
    163171        glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[3])
    164172        glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstride/3)
    165173        glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
    class GLPixmapBacking(PixmapBacking): 
    181189
    182190        # Reset state
    183191        glEnable(GL_FRAGMENT_PROGRAM_ARB)
    184         self.gl_end(drawable)
     192        glFlush()
     193        glDrawBuffer(GL_BACK)
     194        drawable.gl_end()
    185195        return True
    186196
    187197    def do_video_paint(self, coding, img_data, x, y, w, h, options, callbacks):