summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Smith <bruce@nanorex.com>2009-03-06 17:09:29 +0000
committerBruce Smith <bruce@nanorex.com>2009-03-06 17:09:29 +0000
commitdba5a3b59ca4ffca930b60bea185e4c0b1dc4c28 (patch)
tree15248911cffbe74593b2501d9b3cb5a285d4d027
parent06cfb9f31a70a8ce55fe63bf70b8b2b51a71d172 (diff)
downloadnanoengineer-theirix-dba5a3b59ca4ffca930b60bea185e4c0b1dc4c28.tar.gz
nanoengineer-theirix-dba5a3b59ca4ffca930b60bea185e4c0b1dc4c28.zip
rename texture_xforms -> TEXTURE_XFORMS
-rw-r--r--cad/src/graphics/drawing/GLPrimitiveBuffer.py2
-rw-r--r--cad/src/graphics/drawing/cylinder_shader.py6
-rw-r--r--cad/src/graphics/drawing/gl_shaders.py20
-rw-r--r--cad/src/graphics/drawing/sphere_shader.py6
-rw-r--r--cad/src/prototype/test_drawing.py12
5 files changed, 23 insertions, 23 deletions
diff --git a/cad/src/graphics/drawing/GLPrimitiveBuffer.py b/cad/src/graphics/drawing/GLPrimitiveBuffer.py
index 3286d5a99..3ab77e964 100644
--- a/cad/src/graphics/drawing/GLPrimitiveBuffer.py
+++ b/cad/src/graphics/drawing/GLPrimitiveBuffer.py
@@ -371,7 +371,7 @@ class GLPrimitiveBuffer(object):
# XXX No transform data until that is more implemented.
###self.shader.setupTransforms(self.transforms)
- if self.shader.get_texture_xforms():
+ if self.shader.get_TEXTURE_XFORMS():
# Activate a texture unit for transforms.
## XXX Not necessary for custom shader programs.
##glEnable(GL_TEXTURE_2D)
diff --git a/cad/src/graphics/drawing/cylinder_shader.py b/cad/src/graphics/drawing/cylinder_shader.py
index 2c3fc194c..00ea6de1a 100644
--- a/cad/src/graphics/drawing/cylinder_shader.py
+++ b/cad/src/graphics/drawing/cylinder_shader.py
@@ -152,7 +152,7 @@ Russ 090106: Design description file created.
# <line 0>
# ================================================================
-# Note: if texture_xforms is off, a #define N_CONST_XFORMS array dimension is
+# Note: if TEXTURE_XFORMS is off, a #define N_CONST_XFORMS array dimension is
# prepended to the following. The #version statement precedes it.
cylinderVertSrc = """
// Vertex shader program for cylinder primitives.
@@ -267,7 +267,7 @@ void main(void) {
for (i = 0; i <= 1; i++)
endpts[i] = transforms[int(transform_id)] * endpts[i];
-#else // texture_xforms.
+#else // TEXTURE_XFORMS
# if 0 // 1 /// Never check in a 1 value.
xform = mat4(1.0); /// Testing, override texture xform with identity matrix.
# else
@@ -283,7 +283,7 @@ void main(void) {
# endif
for (i = 0; i <= 1; i++)
endpts[i] = xform * endpts[i];
-#endif // texture_xforms.
+#endif // TEXTURE_XFORMS
}
//] ----------------------------------------------------------------
diff --git a/cad/src/graphics/drawing/gl_shaders.py b/cad/src/graphics/drawing/gl_shaders.py
index 75cb78d7e..acee83491 100644
--- a/cad/src/graphics/drawing/gl_shaders.py
+++ b/cad/src/graphics/drawing/gl_shaders.py
@@ -30,7 +30,7 @@ History:
Russ 081002: Added some Transform state to GLSphereShaderObject, and code to
notice when there is not enough constant memory for a matrix block
- there. Added get_texture_xforms() and get_N_CONST_XFORMS() methods.
+ there. Added get_TEXTURE_XFORMS() and get_N_CONST_XFORMS() methods.
Moved GLSphereBuffer to its own file. Much of its code goes to the new
superclass, GLPrimitiveBuffer, and its helper classes HunkBuffer and Hunk.
@@ -49,7 +49,7 @@ Russ 090116: Factored GLShaderObject out of GLSphereShaderObject, and added
"""
# Whether to use texture memory for transforms, or a uniform array of mat4s.
-texture_xforms = False # True
+TEXTURE_XFORMS = False # True
# Otherwise, use a fixed-sized block of uniform memory for transforms.
# (This is a max, refined using GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB later.)
N_CONST_XFORMS = 270 # (Gets CPU bound at 275. Dunno why.)
@@ -199,7 +199,7 @@ class GLShaderObject(object):
self.transform_memory = None # Texture memory handle.
# Configure the max constant RAM used for a "uniform" transforms block.
- if not texture_xforms: # Won't be used if transforms in texture memory.
+ if not TEXTURE_XFORMS: # Won't be used if transforms in texture memory.
global N_CONST_XFORMS
oldNCX = N_CONST_XFORMS
maxComponents = glGetInteger(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB)
@@ -231,7 +231,7 @@ class GLShaderObject(object):
#version 120
"""
# Insert preprocessor constants.
- if not texture_xforms:
+ if not TEXTURE_XFORMS:
prefix += "#define N_CONST_XFORMS %d\n" % N_CONST_XFORMS
else:
prefix += "" # To keep the shader line numbers unchanged.
@@ -288,11 +288,11 @@ class GLShaderObject(object):
try:
glCompileShaderARB(shader) # Checks status, raises error if bad.
except:
+ self.error = True
types = {GL_VERTEX_SHADER:"vertex", GL_FRAGMENT_SHADER:"fragment"}
print ("\n%s %s shader program compilation error" %
(shaderName, types[shaderType]))
print glGetInfoLogARB(shader)
- self.error = True
pass
return shader
@@ -543,8 +543,8 @@ class GLShaderObject(object):
self._active = on
return
- def get_texture_xforms(self):
- return texture_xforms
+ def get_TEXTURE_XFORMS(self):
+ return TEXTURE_XFORMS
def get_N_CONST_XFORMS(self):
return N_CONST_XFORMS
@@ -554,7 +554,7 @@ class GLShaderObject(object):
"""
Fill a block of transforms.
- Depending on the setting of texture_xforms, the transforms are either in
+ Depending on the setting of TEXTURE_XFORMS, the transforms are either in
texture memory, or else in a uniform array of mat4s ("constant memory".)
@param transforms: A list of transform matrices, where each transform is
@@ -567,7 +567,7 @@ class GLShaderObject(object):
# The shader bypasses transform logic if n_transforms is 0.
# (Then location coordinates are in global modeling coordinates.)
if nTransforms > 0:
- if not texture_xforms:
+ if not TEXTURE_XFORMS:
# Load into constant memory. The GL_EXT_bindable_uniform
# extension supports sharing this array of mat4s through a VBO.
# XXX Need to bank-switch this data if more than N_CONST_XFORMS.
@@ -577,7 +577,7 @@ class GLShaderObject(object):
min(len(transforms), N_CONST_XFORMS),
GL_TRUE, # Transpose.
C_transforms)
- else: # texture_xforms
+ else: # TEXTURE_XFORMS
# Generate a texture ID and bind the texture unit to it.
self.transform_memory = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, self.transform_memory)
diff --git a/cad/src/graphics/drawing/sphere_shader.py b/cad/src/graphics/drawing/sphere_shader.py
index 97ebbc32b..7104f6926 100644
--- a/cad/src/graphics/drawing/sphere_shader.py
+++ b/cad/src/graphics/drawing/sphere_shader.py
@@ -67,7 +67,7 @@ Russ 090106: Chopped the GLSL source string blocks out of gl_shaders.py .
# <line 0>
# ================================================================
-# Note: if texture_xforms is off, a #define N_CONST_XFORMS array dimension is
+# Note: if TEXTURE_XFORMS is off, a #define N_CONST_XFORMS array dimension is
# prepended to the following. The #version statement must precede it.
sphereVertSrc = """
// Vertex shader program for sphere primitives.
@@ -136,7 +136,7 @@ void main(void) { // Vertex shader procedure.
// Get transforms from a fixed-sized block of uniform (constant) memory.
// The GL_EXT_bindable_uniform extension allows sharing this through a VBO.
center = transforms[int(transform_id)] * center;
-#else // texture_xforms.
+#else // TEXTURE_XFORMS
# if 0 // 1 /// Never check in a 1 value.
xform = mat4(1.0); /// Testing, override texture xform with identity matrix.
# else
@@ -151,7 +151,7 @@ void main(void) { // Vertex shader procedure.
texture2D(transforms, vec2(3.0/3.0, mat)));
# endif
center = xform * center;
-#endif // texture_xforms.
+#endif // TEXTURE_XFORMS
}
//] ----------------------------------------------------------------
diff --git a/cad/src/prototype/test_drawing.py b/cad/src/prototype/test_drawing.py
index a239e187a..6d896ef38 100644
--- a/cad/src/prototype/test_drawing.py
+++ b/cad/src/prototype/test_drawing.py
@@ -188,7 +188,7 @@ testCase = 8.3; nSpheres = 2; chunkLength = 8
# 16x16 sphere array, chunked by columns for vertex shader debugging display.
#nSpheres = transformChunkLength = 16
#
-# Short chunks ok w/ texture_xforms = 1, but too many chunks for N_CONST_XFORMS.
+# Short chunks ok w/ TEXTURE_XFORMS = True, but too many chunks for N_CONST_XFORMS.
#nSpheres = 132; transformChunkLength = 70 # 249 chunks.
#nSpheres = 132; transformChunkLength = 50 # 349 chunks.
#nSpheres = 132; transformChunkLength = 20 # 872 chunks.
@@ -456,17 +456,17 @@ def test_drawing(glpane, initOnly = False):
" w/ Python array buffering.")
# . 3.4 - Big batch draw, with transforms indexed by IDs added.
# (Second FPS number with debug colors in the vertex shader off.)
- # - 90,000 (300x300) spheres, texture_xforms = 1, 26(29) FPS
+ # - 90,000 (300x300) spheres, TEXTURE_XFORMS = True, 26(29) FPS
# - 90,000 (300x300) spheres, N_CONST_XFORMS = 250, 26(29) FPS
# - 90,000 (300x300) spheres, N_CONST_XFORMS = 275, 0.3(0.6) FPS
# (What happens after 250? CPU usage goes from 40% to 94%.)
- # -160,000 (400x400) spheres, texture_xforms = 1, 26 FPS
- # -250,000 (500x500) spheres, texture_xforms = 1, 26 FPS
+ # -160,000 (400x400) spheres, TEXTURE_XFORMS = True, 26 FPS
+ # -250,000 (500x500) spheres, TEXTURE_XFORMS = True, 26 FPS
elif testCase == 3.4:
print ("Sub-test 3.4, add transforms indexed by IDs.")
- from graphics.drawing.gl_shaders import texture_xforms
+ from graphics.drawing.gl_shaders import TEXTURE_XFORMS
from graphics.drawing.gl_shaders import N_CONST_XFORMS
- if texture_xforms:
+ if TEXTURE_XFORMS:
print "Transforms in texture memory."
else:
print "%d transforms in uniform memory." % N_CONST_XFORMS