Ticket #478: gl-noclear.patch
File gl-noclear.patch, 2.8 KB (added by , 7 years ago) |
---|
-
xpra/client/gl/gl_window_backing.py
136 136 self.texture_size = 0, 0 137 137 self.gl_setup = False 138 138 self.debug_setup = False 139 self.resize = False 139 140 self.paint_screen = False 140 141 self._video_use_swscale = False 141 142 self.draw_needs_refresh = False … … 145 146 return "GLPixmapBacking(%s, %s, %s)" % (self.wid, self.size, self.pixel_format) 146 147 147 148 def init(self, w, h): 149 log.info("init(%s, %s) gl_setup=%s", w, h, self.gl_setup) 148 150 #re-init gl projection with new dimensions 149 151 #(see gl_init) 150 152 if self.size!=(w, h): 153 self.resize = (self.size!=(0, 0)) 151 154 self.gl_setup = False 152 155 self.size = w, h 153 156 … … 224 227 self.gl_init_debug() 225 228 226 229 if not self.gl_setup: 227 self.gl_marker("Initializing GL context for window size %d x %d " % (w, h))230 self.gl_marker("Initializing GL context for window size %d x %d (resize=%s)" % (w, h, self.resize)) 228 231 # Initialize viewport and matrices for 2D rendering 229 232 glViewport(0, 0, w, h) 230 233 glMatrixMode(GL_PROJECTION) … … 235 238 # glEnableClientState(GL_VERTEX_ARRAY) 236 239 # glEnableClientState(GL_TEXTURE_COORD_ARRAY) 237 240 241 #if not self.resize: 238 242 # Clear background to transparent black 239 243 glClearColor(0.0, 0.0, 0.0, 0.0) 240 244 … … 248 252 # Define empty FBO texture and set rendering to FBO 249 253 glEnable(GL_FRAGMENT_PROGRAM_ARB) 250 254 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_FBO]) 251 glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, None) 255 if not self.resize: 256 glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, None) 252 257 glBindFramebuffer(GL_FRAMEBUFFER, self.offscreen_fbo) 253 258 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_FBO], 0) 254 glClear(GL_COLOR_BUFFER_BIT) 259 if not self.resize: 260 glClear(GL_COLOR_BUFFER_BIT) 261 #if not self.resize: 262 #glClearColor(0.0, 0.0, 0.0, 0.0) 255 263 256 264 # Create and assign fragment programs 257 265 if not self.shaders: … … 260 268 # Bind program 0 for YUV painting by default 261 269 glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, self.shaders[YUV2RGB_SHADER]) 262 270 self.gl_setup = True 271 self.resize = False 263 272 return drawable 264 273 265 274 def close(self):