Skip to content

Commit

Permalink
#1024: always set GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL befo…
Browse files Browse the repository at this point in the history
…re initializing the textures with glTexImage2D or glTexSubImage2D

git-svn-id: https://xpra.org/svn/Xpra/trunk@11150 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 8, 2015
1 parent b25c62a commit 706a47b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_fcolor(encoding):
GL_DONT_CARE, GL_TRUE, GL_DEPTH_TEST, GL_SCISSOR_TEST, GL_LIGHTING, GL_DITHER, \
GL_RGB, GL_RGBA, GL_BGR, GL_BGRA, \
GL_BLEND, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, \
GL_TEXTURE_MAX_LEVEL, \
GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_BASE_LEVEL, \
GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST, \
glLineStipple, GL_LINE_STIPPLE, \
glTexEnvi, GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE, \
Expand Down Expand Up @@ -399,6 +399,7 @@ def gl_init(self):
glEnable(GL_FRAGMENT_PROGRAM_ARB)
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, self.textures[TEX_FBO])
# nvidia needs this even though we don't use mipmaps (repeated through this file):
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BASE_LEVEL, 0)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAX_LEVEL, 0)
try:
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, self.texture_pixel_format, w, h, 0, self.texture_pixel_format, GL_UNSIGNED_BYTE, None)
Expand Down Expand Up @@ -682,6 +683,7 @@ def _do_paint_rgb(self, bpp, img_data, x, y, width, height, rowstride, options):
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BASE_LEVEL, 0)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAX_LEVEL, 0)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)
Expand Down Expand Up @@ -768,6 +770,7 @@ def update_planar_textures(self, x, y, width, height, img, pixel_format, scaling
mag_filter = GL_LINEAR
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, mag_filter)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BASE_LEVEL, 0)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAX_LEVEL, 0)
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_LUMINANCE, width//div_w, height//div_h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, None)

Expand All @@ -782,6 +785,8 @@ def update_planar_textures(self, x, y, width, height, img, pixel_format, scaling
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowstrides[index])
upload, pixel_data = self.pixels_for_upload(img_data[index])
log("texture %s: div=%s, rowstride=%s, %sx%s, data=%s bytes, upload=%s", index, divs[index], rowstrides[index], width//div_w, height//div_h, len(pixel_data), upload)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_BASE_LEVEL, 0)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAX_LEVEL, 0)
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width//div_w, height//div_h, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixel_data)

def render_planar_update(self, rx, ry, rw, rh, x_scale=1, y_scale=1):
Expand Down

0 comments on commit 706a47b

Please sign in to comment.