// File: tomfunkhouser[P]gaps/apps/gapsview/gapsview.cpp
// Function: GLUTInit(int*, char**)
static void
GLUTInit(int *argc, char **argv)
{
  // Open window 
  glutInit(argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA | GLUT_MULTISAMPLE);
  GLUTwindow = glutCreateWindow("GAPS Viewer");
  
  // Initialize grfx (after create context because calls glewInit)
  RNInitGrfx();

  // Initialize multisampling
  glEnable(GL_MULTISAMPLE);
  
  // Initialize background color 
  glClearColor(200.0/255.0, 200.0/255.0, 200.0/255.0, 1.0);

  // Initialize lights
  static GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
  static GLfloat light0_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glEnable(GL_LIGHT0);
  static GLfloat light1_diffuse[] = { 0.5, 0.5, 0.5, 1.0 };
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glEnable(GL_LIGHT1);
  glEnable(GL_NORMALIZE);
  glEnable(GL_LIGHTING);

  // Initialize color settings
  glEnable(GL_COLOR_MATERIAL);
  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

  // Initialize graphics modes 
  glEnable(GL_DEPTH_TEST);

  // Initialize GLUT callback functions 
  glutDisplayFunc(GLUTRedraw);
  glutReshapeFunc(GLUTResize);
  glutKeyboardFunc(GLUTKeyboard);
  glutSpecialFunc(GLUTSpecial);
  glutMouseFunc(GLUTMouse);
  glutMotionFunc(GLUTMotion);

  // Initialize font
#if (RN_OS == RN_WINDOWSNT)
  int font = glGenLists(256);
  wglUseFontBitmaps(wglGetCurrentDC(), 0, 256, font); 
  glListBase(font);
#endif
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x1f5400
movl $0x64, %esi
movl %esi, %edi
callq 0x1f5b80
movl 0x2c0e01(%rip), %edi    # 0x2efaf0
movl 0x2c0dff(%rip), %esi    # 0x2efaf4
callq 0x1f5bc0
movl $0x9a, %edi
callq 0x1f5c00
leaq 0x237738(%rip), %rdi    # 0x266443
callq 0x1fe420
movl %eax, 0x2cffaa(%rip)    # 0x2fecc0
callq 0x1c71f0
movl $0x809d, %edi           # imm = 0x809D
callq 0x29a50
movss 0x2373e3(%rip), %xmm2   # 0x266110
movss 0x2373df(%rip), %xmm3   # 0x266114
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x29250
movl $0xb53, %edi            # imm = 0xB53
leaq 0x2c0db4(%rip), %rsi    # 0x2efb00
callq 0x29f10
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x2a160
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
leaq 0x2c0d9f(%rip), %rdx    # 0x2efb10
callq 0x293d0
movl $0x4000, %edi           # imm = 0x4000
callq 0x29a50
movl $0x4001, %edi           # imm = 0x4001
movl $0x1201, %esi           # imm = 0x1201
leaq 0x2c0d8f(%rip), %rdx    # 0x2efb20
callq 0x293d0
movl $0x4001, %edi           # imm = 0x4001
callq 0x29a50
movl $0xba1, %edi            # imm = 0xBA1
callq 0x29a50
movl $0xb50, %edi            # imm = 0xB50
callq 0x29a50
movl $0xb57, %edi            # imm = 0xB57
callq 0x29a50
movl $0x404, %edi            # imm = 0x404
movl $0x1602, %esi           # imm = 0x1602
callq 0x2a530
movl $0xb71, %edi            # imm = 0xB71
callq 0x29a50
leaq 0xfe2(%rip), %rdi       # 0x2fdc0
callq 0x1f33a0
leaq 0x1076(%rip), %rdi      # 0x2fe60
callq 0x1f3420
leaq 0x10ba(%rip), %rdi      # 0x2feb0
callq 0x1f3490
leaq 0x18ee(%rip), %rdi      # 0x306f0
callq 0x1f3500
leaq 0x1b52(%rip), %rdi      # 0x30960
callq 0x1f3a30
leaq 0x1e16(%rip), %rdi      # 0x30c30
callq 0x1f3b10
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)