// File: tomfunkhouser[P]gaps/apps/confview/confview.cpp
// Function: GLUTRedraw()
void GLUTRedraw(void)
{
  // Set viewing transformation
  viewer.Camera().Load();

  // Clear window 
  // glClearColor(0.0, 0.0, 0.0, 1.0);
  glClearColor(background.R(), background.G(), background.B(), 1.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // Draw everything
  if (show_cameras) DrawCameras(color_scheme);
  if (show_bboxes) DrawBBoxes(color_scheme);
  if (show_images) DrawImages(color_scheme);
  if (show_patches) DrawPatches(color_scheme);
  if (show_faces) DrawFaces(color_scheme);
  if (show_edges) DrawEdges(color_scheme);
  if (show_vertices) DrawVertices(color_scheme);
  if (show_points) DrawPoints(color_scheme);
  if (show_surfels) DrawSurfels(color_scheme);
  if (show_quads) DrawQuads(color_scheme);
  if (show_textures) DrawTextures(color_scheme);
  if (show_overlaps) DrawOverlaps();
  if (show_selected_position) DrawSelectedPosition();
  if (show_axes) DrawAxes();

  // Capture screenshot image 
  if (screenshot_image_name) {
    if (print_verbose) printf("Creating image %s\n", screenshot_image_name);
    R2Image image(GLUTwindow_width, GLUTwindow_height, 3);
    image.Capture();
    image.Write(screenshot_image_name);
    screenshot_image_name = NULL;
  }

  // Swap buffers 
  glutSwapBuffers();
}

// Assembly:
subq $0x38, %rsp
leaq 0x212a65(%rip), %rdi    # 0x23bce0
callq 0x2e900
movq %rax, %rdi
xorl %esi, %esi
callq 0x4f3c0
leaq 0x212a1f(%rip), %rdi    # 0x23bcb0
callq 0x2e910
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
leaq 0x212a09(%rip), %rdi    # 0x23bcb0
callq 0x2e920
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x2129f3(%rip), %rdi    # 0x23bcb0
callq 0x2e930
movss 0xc(%rsp), %xmm1
movaps %xmm0, %xmm2
movss 0x10(%rsp), %xmm0
cvtsd2ss %xmm2, %xmm2
movss 0x19ddbb(%rip), %xmm3   # 0x1c7098
callq 0x25000
movl $0x4100, %edi           # imm = 0x4100
callq 0x24220
cmpl $0x0, 0x20c7dd(%rip)    # 0x235ad0
je 0x29300
movl 0x20c7d9(%rip), %edi    # 0x235ad4
callq 0x294d0
cmpl $0x0, 0x212a8d(%rip)    # 0x23bd94
je 0x29314
movl 0x20c7c5(%rip), %edi    # 0x235ad4
callq 0x29590
cmpl $0x0, 0x212a7d(%rip)    # 0x23bd98
je 0x29328
movl 0x20c7b1(%rip), %edi    # 0x235ad4
callq 0x29630
cmpl $0x0, 0x212a6d(%rip)    # 0x23bd9c
je 0x2934f
movl 0x20c79d(%rip), %edi    # 0x235ad4
movsd 0x19dcd9(%rip), %xmm1   # 0x1c7018
movsd 0x19dcd9(%rip), %xmm2   # 0x1c7020
movaps %xmm1, %xmm0
callq 0x29710
cmpl $0x0, 0x212a4a(%rip)    # 0x23bda0
je 0x29363
movl 0x20c776(%rip), %edi    # 0x235ad4
callq 0x29a40
cmpl $0x0, 0x212a3a(%rip)    # 0x23bda4
je 0x29377
movl 0x20c762(%rip), %edi    # 0x235ad4
callq 0x29ad0
cmpl $0x0, 0x212a2a(%rip)    # 0x23bda8
je 0x2938b
movl 0x20c74e(%rip), %edi    # 0x235ad4
callq 0x29b60
cmpl $0x0, 0x212a1a(%rip)    # 0x23bdac
je 0x293a4
movl 0x20c73a(%rip), %edi    # 0x235ad4
movl $0x1, %esi
callq 0x29bf0
cmpl $0x0, 0x212a05(%rip)    # 0x23bdb0
je 0x293bd
movl 0x20c721(%rip), %edi    # 0x235ad4
movl $0x1, %esi
callq 0x29cb0
cmpl $0x0, 0x2129f0(%rip)    # 0x23bdb4
je 0x293d6
movl 0x20c708(%rip), %edi    # 0x235ad4
movl $0x1, %esi
callq 0x29d70
cmpl $0x0, 0x2129db(%rip)    # 0x23bdb8
je 0x293ea
movl 0x20c6ef(%rip), %edi    # 0x235ad4
callq 0x29e30
cmpl $0x0, 0x2129cb(%rip)    # 0x23bdbc
je 0x293fd
movl $0x3, %edi
callq 0x29ec0
cmpl $0x0, 0x20c6d4(%rip)    # 0x235ad8
je 0x2940b
callq 0x2a0d0
cmpl $0x0, 0x2129ae(%rip)    # 0x23bdc0
je 0x29419
callq 0x2a180
cmpq $0x0, 0x2129a7(%rip)    # 0x23bdc8
je 0x294b3
cmpl $0x0, 0x2129a2(%rip)    # 0x23bdd0
je 0x29445
movq 0x212991(%rip), %rsi    # 0x23bdc8
leaq 0x19de7a(%rip), %rdi    # 0x1c72b8
movb $0x0, %al
callq 0x24090
movl 0x20c691(%rip), %esi    # 0x235adc
movl 0x20c68f(%rip), %edx    # 0x235ae0
leaq 0x20(%rsp), %rdi
movq %rdi, (%rsp)
movl $0x3, %ecx
callq 0x11f4b0
movq (%rsp), %rdi
callq 0x1208d0
jmp 0x2946f
movq 0x212952(%rip), %rsi    # 0x23bdc8
leaq 0x20(%rsp), %rdi
callq 0x2e940
jmp 0x29482
movq $0x0, 0x21293b(%rip) # 0x23bdc8
leaq 0x20(%rsp), %rdi
callq 0x11f9d0
jmp 0x294b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x11f9d0
jmp 0x294bd
callq 0x1b2b40
addq $0x38, %rsp
retq
movq 0x18(%rsp), %rdi
callq 0x252b0
nopw (%rax,%rax)