]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fixed another place where set_rgbmode() should be called.
authorGuido van Rossum <guido@python.org>
Thu, 10 Jun 1993 14:42:03 +0000 (14:42 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 10 Jun 1993 14:42:03 +0000 (14:42 +0000)
Separated out colormap installation (for override by Glx widget).

Demo/sgi/video/VFile.py

index f04d93b852e52e99c3bab0696a7c113860462506..8e093b80cd683a61f2194104bc88fd7e91413aca 100755 (executable)
@@ -449,8 +449,7 @@ class Displayer(VideoParams):
                # This only works on an Entry-level Indigo from IRIX 4.0.5
                if self.format == 'rgb8' and is_entry_indigo() and \
                          gl.gversion() == 'GL4DLG-4.0.': # Note trailing '.'!
-                       gl.RGBmode()
-                       gl.gconfig()
+                       self.set_rgbmode()
                        gl.RGBcolor(200, 200, 200) # XXX rather light grey
                        gl.clear()
                        gl.pixmode(GL.PM_SIZE, 8)
@@ -514,6 +513,7 @@ class Displayer(VideoParams):
        # by clear() and clearto()
 
        def _initcmap(self):
+               map = []
                if self.format in ('mono', 'grey4') and self.mustunpack:
                        convcolor = conv_grey
                else:
@@ -564,12 +564,22 @@ class Displayer(VideoParams):
                                                r, g, b = int(rv*255.0), \
                                                          int(gv*255.0), \
                                                          int(bv*255.0)
-                                               gl.mapcolor(index, r, g, b)
+                                               map.append(index, r, g, b)
                                                if self.color0 == None:
                                                        self.color0 = \
                                                                index, r, g, b
+               self.install_colormap(map)
                # Permanently make the first color index current
                gl.color(self.color0[0])
+
+       # Install the colormap in the window (may be overridden for Glx window)
+
+       def install_colormap(self, map):
+               if not self.quiet:
+                       sys.stderr.write(' Installing ' + `len(map)` + \
+                                 ' entries...')
+               for irgb in map:
+                       gl.mapcolor(irgb)
                gl.gflush() # send the colormap changes to the X server