// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PointSet.cpp
// Function: gaps::R3PointSet::GLRgbColorBufferObject() const
unsigned int R3PointSet::
GLRgbColorBufferObject(void) const
{
  // Check if nothing to be done
  if (NPoints() == 0) return 0;

  // Update rgb color buffer
  if (vbo_rgb_color_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_rgb_color_buffer);
    if (vbo_rgb_color_buffer > 0) {
      std::vector<GLubyte> rgb_colors;
      for (int i = 0; i < NPoints(); i++) {
        const RNRgb& rgb_color = PointColor(i);
        rgb_colors.push_back(255.0 * rgb_color.R());
        rgb_colors.push_back(255.0 * rgb_color.G());
        rgb_colors.push_back(255.0 * rgb_color.B());
        rgb_colors.push_back(255);
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_rgb_color_buffer);
      glBufferData(GL_ARRAY_BUFFER, rgb_colors.size() * sizeof(GLubyte), &rgb_colors[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return buffer object identifier
  return vbo_rgb_color_buffer;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq 0x88(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x32400
cmpl $0x0, %eax
jne 0xddda6
movl $0x0, 0x94(%rsp)
jmp 0xddfd7
movq 0x40(%rsp), %rax
cmpl $0x0, 0x110(%rax)
jne 0xddfc5
movq 0x40(%rsp), %rsi
movq 0x14b1e4(%rip), %rax    # 0x228fa8
movq (%rax), %rax
addq $0x110, %rsi            # imm = 0x110
movl $0x1, %edi
callq *%rax
movq 0x40(%rsp), %rax
cmpl $0x0, 0x110(%rax)
jbe 0xddfc3
leaq 0x70(%rsp), %rdi
callq 0xaf9d0
movl $0x0, 0x6c(%rsp)
movq 0x40(%rsp), %rdi
movl 0x6c(%rsp), %eax
movl %eax, 0x38(%rsp)
callq 0x32400
movl %eax, 0x3c(%rsp)
jmp 0xdde11
movl 0x38(%rsp), %eax
movl 0x3c(%rsp), %ecx
cmpl %ecx, %eax
jge 0xddf3c
movq 0x40(%rsp), %rdi
movl 0x6c(%rsp), %esi
callq 0xe0250
movq %rax, 0x30(%rsp)
jmp 0xdde36
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
callq 0x53220
movsd %xmm0, 0x28(%rsp)
jmp 0xdde52
movsd 0x28(%rsp), %xmm0
movsd 0xddbe0(%rip), %xmm1    # 0x1bba40
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x4f(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x4f(%rsp), %rsi
callq 0xaf9e0
jmp 0xdde7d
movq 0x50(%rsp), %rdi
callq 0x53230
movsd %xmm0, 0x20(%rsp)
jmp 0xdde8f
movsd 0x20(%rsp), %xmm0
movsd 0xddba3(%rip), %xmm1    # 0x1bba40
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x4e(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x4e(%rsp), %rsi
callq 0xaf9e0
jmp 0xddeba
movq 0x50(%rsp), %rdi
callq 0x53240
movsd %xmm0, 0x18(%rsp)
jmp 0xddecc
movsd 0x18(%rsp), %xmm0
movsd 0xddb66(%rip), %xmm1    # 0x1bba40
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0x4d(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x4d(%rsp), %rsi
callq 0xaf9e0
jmp 0xddef7
movb $-0x1, 0x4c(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x4c(%rsp), %rsi
callq 0xaf9e0
jmp 0xddf0d
jmp 0xddf0f
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0xdddf9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0xafa50
jmp 0xddfe6
movq 0x40(%rsp), %rcx
movq 0x14b080(%rip), %rax    # 0x228fc8
movq (%rax), %rax
movl 0x110(%rcx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *%rax
jmp 0xddf5a
movq 0x14b077(%rip), %rax    # 0x228fd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x70(%rsp), %rdi
movq %rdi, (%rsp)
callq 0xafa10
movq (%rsp), %rdi
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0xafa30
movq 0x8(%rsp), %rsi
movq %rax, %rdx
movq 0x10(%rsp), %rax
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *%rax
jmp 0xddfa4
movq 0x14b01d(%rip), %rax    # 0x228fc8
movq (%rax), %rax
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
callq *%rax
jmp 0xddfb9
leaq 0x70(%rsp), %rdi
callq 0xafa50
jmp 0xddfc5
movq 0x40(%rsp), %rax
movl 0x110(%rax), %eax
movl %eax, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x24250