// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::InvalidateGLBufferObjects()
void R3Mesh::
InvalidateGLBufferObjects(void)
{
  // Delete face buffers
  if (vbo_face_position_buffer > 0) glDeleteBuffers(1, &vbo_face_position_buffer);
  if (vbo_face_normal_buffer > 0) glDeleteBuffers(1, &vbo_face_normal_buffer);
  if (vbo_face_texcoord_buffer > 0) glDeleteBuffers(1, &vbo_face_texcoord_buffer);
  if (vbo_face_rgb_color_buffer > 0) glDeleteBuffers(1, &vbo_face_rgb_color_buffer);
  if (vbo_face_pick_color_buffer > 0) glDeleteBuffers(1, &vbo_face_pick_color_buffer);

  // Delete vertex buffers
  if (vbo_vertex_position_buffer > 0) glDeleteBuffers(1, &vbo_vertex_position_buffer);
  if (vbo_vertex_normal_buffer > 0) glDeleteBuffers(1, &vbo_vertex_normal_buffer);
  if (vbo_vertex_texcoord_buffer > 0) glDeleteBuffers(1, &vbo_vertex_texcoord_buffer);
  if (vbo_vertex_rgb_color_buffer > 0) glDeleteBuffers(1, &vbo_vertex_rgb_color_buffer);
  if (vbo_vertex_pick_color_buffer > 0) glDeleteBuffers(1, &vbo_vertex_pick_color_buffer);

  // Zero out face buffer identifiers
  vbo_face_position_buffer = 0;
  vbo_face_normal_buffer = 0;
  vbo_face_texcoord_buffer = 0;
  vbo_face_rgb_color_buffer = 0;
  vbo_face_pick_color_buffer = 0;

  // Zero out vertex buffer identifiers
  vbo_vertex_position_buffer = 0;
  vbo_vertex_normal_buffer = 0;
  vbo_vertex_texcoord_buffer = 0;
  vbo_vertex_rgb_color_buffer = 0;
  vbo_vertex_pick_color_buffer = 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x50(%rax)
jbe 0x239f3
movq 0x8(%rsp), %rsi
movq 0x14b5f3(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x50, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x54(%rax)
jbe 0x23a18
movq 0x8(%rsp), %rsi
movq 0x14b5ce(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x54, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x58(%rax)
jbe 0x23a3d
movq 0x8(%rsp), %rsi
movq 0x14b5a9(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x58, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x5c(%rax)
jbe 0x23a62
movq 0x8(%rsp), %rsi
movq 0x14b584(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x5c, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x60(%rax)
jbe 0x23a87
movq 0x8(%rsp), %rsi
movq 0x14b55f(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x60, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x64(%rax)
jbe 0x23aac
movq 0x8(%rsp), %rsi
movq 0x14b53a(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x64, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x68(%rax)
jbe 0x23ad1
movq 0x8(%rsp), %rsi
movq 0x14b515(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x68, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x6c(%rax)
jbe 0x23af6
movq 0x8(%rsp), %rsi
movq 0x14b4f0(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x6c, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x70(%rax)
jbe 0x23b1b
movq 0x8(%rsp), %rsi
movq 0x14b4cb(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x70, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
cmpl $0x0, 0x74(%rax)
jbe 0x23b40
movq 0x8(%rsp), %rsi
movq 0x14b4a6(%rip), %rax    # 0x16efd8
movq (%rax), %rax
addq $0x74, %rsi
movl $0x1, %edi
callq *%rax
movq 0x8(%rsp), %rax
movl $0x0, 0x50(%rax)
movl $0x0, 0x54(%rax)
movl $0x0, 0x58(%rax)
movl $0x0, 0x5c(%rax)
movl $0x0, 0x60(%rax)
movl $0x0, 0x64(%rax)
movl $0x0, 0x68(%rax)
movl $0x0, 0x6c(%rax)
movl $0x0, 0x70(%rax)
movl $0x0, 0x74(%rax)
addq $0x18, %rsp
retq