Commits

Cliff Biffle committed 33b7839

Only bother uploading the camera color image if we're actually using it to texture anything. Slight performance win when viewing raw depth data (which is all the time right now, since texturing is broken).

  • Participants
  • Parent commits 4b5125f
  • Branches shaders

Comments (0)

Files changed (1)

 }
 
 - (void) drawInCurrentOpenGLContextWithOptions: (NSDictionary *) options {
+  BOOL textureFromCamera = NO;  // TODO read from options
+  
   NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
 
   glActiveTexture(GL_TEXTURE0);
   glBindTexture(GL_TEXTURE_2D, depthTexture);
   glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, 640, 480, 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, &depthImage);
-  
-  glActiveTexture(GL_TEXTURE1);
-  glBindTexture(GL_TEXTURE_2D, colorTexture);
-  glTexImage2D(GL_TEXTURE_2D, 0, 3, 640, 480, 0, GL_RGB, GL_UNSIGNED_BYTE, &colorImage);
+
+  // TODO set texturing control uniform bool
+  if (textureFromCamera) {
+    glActiveTexture(GL_TEXTURE1);
+    glBindTexture(GL_TEXTURE_2D, colorTexture);
+    glTexImage2D(GL_TEXTURE_2D, 0, 3, 640, 480, 0, GL_RGB, GL_UNSIGNED_BYTE, &colorImage);
+  }
   
   [self renderAsPointsWithOptions: options];