summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell D. Fish <fish@cs.utah.edu>2009-03-06 22:40:03 +0000
committerRussell D. Fish <fish@cs.utah.edu>2009-03-06 22:40:03 +0000
commit21a1449f6459ccda2b05668be2b103fe389470f1 (patch)
tree9e4f369d66e387cc7541246bea53e69de90187d5
parentb093703dc6d31ad1d5b375c162e0c31836cc3d77 (diff)
downloadnanoengineer-21a1449f6459ccda2b05668be2b103fe389470f1.tar.gz
nanoengineer-21a1449f6459ccda2b05668be2b103fe389470f1.zip
Temporary fix for shader mouseover-picking on Windows, where the last byte of the glname drawn as an RGBA color always comes back as 255. Just use the first 3 bytes, limiting us to 16 million shader primitives.
-rw-r--r--cad/src/graphics/drawing/GLCylinderBuffer.py4
-rw-r--r--cad/src/graphics/drawing/GLSphereBuffer.py4
-rw-r--r--cad/src/graphics/widgets/GLPane_highlighting_methods.py5
3 files changed, 9 insertions, 4 deletions
diff --git a/cad/src/graphics/drawing/GLCylinderBuffer.py b/cad/src/graphics/drawing/GLCylinderBuffer.py
index 748c8ba97..33b87edee 100644
--- a/cad/src/graphics/drawing/GLCylinderBuffer.py
+++ b/cad/src/graphics/drawing/GLCylinderBuffer.py
@@ -134,7 +134,9 @@ class GLCylinderBuffer(GLPrimitiveBuffer):
self.transform_id_Hunks.setData(newID, transform_id)
# Break the glname into RGBA pixel color components, 0.0 to 1.0 .
# (Per-vertex attributes are all multiples (1-4) of Float32.)
- rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(24,-1,-8)]
+ ##rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(24,-1,-8)]
+ ## Temp fix: Ignore the last byte, which always comes back 255 on Windows.
+ rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(16,-1,-8)]+[0.0]
self.glname_color_Hunks.setData(newID, rgba)
continue
diff --git a/cad/src/graphics/drawing/GLSphereBuffer.py b/cad/src/graphics/drawing/GLSphereBuffer.py
index 47b486719..d465a5d24 100644
--- a/cad/src/graphics/drawing/GLSphereBuffer.py
+++ b/cad/src/graphics/drawing/GLSphereBuffer.py
@@ -113,7 +113,9 @@ class GLSphereBuffer(GLPrimitiveBuffer):
self.transform_id_Hunks.setData(newID, transform_id)
# Break the glname into RGBA pixel color components, 0.0 to 1.0 .
# (Per-vertex attributes are all multiples (1-4) of Float32.)
- rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(24,-1,-8)]
+ ##rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(24,-1,-8)]
+ ## Temp fix: Ignore the last byte, which always comes back 255 on Windows.
+ rgba = [(glname >> bits & 0xff) / 255.0 for bits in range(16,-1,-8)]+[0.0]
self.glname_color_Hunks.setData(newID, rgba)
continue
diff --git a/cad/src/graphics/widgets/GLPane_highlighting_methods.py b/cad/src/graphics/widgets/GLPane_highlighting_methods.py
index 222cf8322..2cfde4611 100644
--- a/cad/src/graphics/widgets/GLPane_highlighting_methods.py
+++ b/cad/src/graphics/widgets/GLPane_highlighting_methods.py
@@ -234,8 +234,9 @@ class GLPane_highlighting_methods(object):
return 256 + b
return b
bytes = tuple([us(b) for b in rgba])
- glname = (bytes[0] << 24 | bytes[1] << 16 |
- bytes[2] << 8 | bytes[3])
+ ##glname = (bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3])
+ ## Temp fix: Ignore the last byte, which always comes back 255 on Windows.
+ glname = (bytes[0] << 16 | bytes[1] << 8 | bytes[2])
if debugPicking:
print ("shader mouseover xy %d %d, " % (wX, wY) +
"rgba bytes (0x%x, 0x%x, 0x%x, 0x%x), " % bytes +