Skip to content

Commit

Permalink
if OpenGL does not have FragmentProgramARB then we can still use it, …
Browse files Browse the repository at this point in the history
…just not for csc. So we toggle use_openGL_CSC flag as needed, and make it global.

git-svn-id: https://xpra.org/svn/Xpra/trunk@930 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 17, 2012
1 parent fa43fc6 commit 444d4f9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/xpra/gl_client_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
raise ImportError("** OpenGL output requires OpenGL version 1.1 or greater, not %s.%s" % (gl_major, gl_minor))
log.info("found valid OpenGL: %s.%s", gl_major, gl_minor)

if not glInitFragmentProgramARB():
#see http://www.opengl.org/registry/specs/ARB/fragment_program.txt
raise ImportError("** OpenGL output requires the ARB_fragment_program extension")
#this allows us to do CSC via OpenGL:
#see http://www.opengl.org/registry/specs/ARB/fragment_program.txt
use_openGL_CSC = glInitFragmentProgramARB()
finally:
gldrawable.gl_end()
del glcontext, gldrawable, glext, glconfig
Expand All @@ -77,7 +77,6 @@ def do_configure_event(self, event):
drawable = self.glarea.get_gl_drawable()
context = self.glarea.get_gl_context()

self.use_openGL_CSC = True
self.yuv420_shader = None
self.current_mode = 0 # 0 = uninitialized 1 = RGB 2 = YUV

Expand Down Expand Up @@ -150,7 +149,7 @@ def close_decoder():
del decoders[self._id]
self._on_close.append(close_decoder)
try:
if self.use_openGL_CSC:
if use_openGL_CSC:
decompress = decoder.decompress_image_to_yuv
update_texture = self.update_texture_yuv420
else:
Expand All @@ -167,7 +166,7 @@ def close_decoder():
log("paint_with_video_decoder: decompressed %s to %s bytes (%s%%) of rgb24 (%s*%s*3=%s) (outstride: %s)", len(img_data), len(data), int(100*len(img_data)/len(data)),width, height, width*height*3, outstride)
update_texture(data, x, y, width, height, outstride)
finally:
if not self.use_openGL_CSC:
if not use_openGL_CSC:
decoder.free_image()

def update_texture_rgb24(self, img_data, x, y, width, height, rowstride):
Expand Down

0 comments on commit 444d4f9

Please sign in to comment.