// File: tomfunkhouser[P]gaps/apps/grdview/grdview.cpp
// Function: GLUTInit(int*, char**)
void GLUTInit(int *argc, char **argv)
{
  // Open window 
  glutInit(argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE);
  GLUTwindow = glutCreateWindow("OpenGL Viewer");

  // Initialize grfx package (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 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 0xef270
movl $0x64, %esi
movl %esi, %edi
callq 0xef9f0
movl 0x18e17d(%rip), %edi    # 0x1b38dc
movl 0x18e17b(%rip), %esi    # 0x1b38e0
callq 0xefa30
movl $0x92, %edi
callq 0xefa70
leaq 0x139ada(%rip), %rdi    # 0x15f255
callq 0xf8290
movl %eax, 0x19caa2(%rip)    # 0x1c2228
callq 0xe8fa0
movl $0x809d, %edi           # imm = 0x809D
callq 0x20740
movss 0x1398ef(%rip), %xmm2   # 0x15f08c
movss 0x1398db(%rip), %xmm3   # 0x15f080
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x20cd0
movl $0xb53, %edi            # imm = 0xB53
leaq 0x18e134(%rip), %rsi    # 0x1b38f0
callq 0x21000
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x20140
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
leaq 0x18e11f(%rip), %rdx    # 0x1b3900
callq 0x20ed0
movl $0x4000, %edi           # imm = 0x4000
callq 0x20740
movl $0x4001, %edi           # imm = 0x4001
movl $0x1201, %esi           # imm = 0x1201
leaq 0x18e10f(%rip), %rdx    # 0x1b3910
callq 0x20ed0
movl $0x4001, %edi           # imm = 0x4001
callq 0x20740
movl $0xba1, %edi            # imm = 0xBA1
callq 0x20740
movl $0xb50, %edi            # imm = 0xB50
callq 0x20740
movl $0xb71, %edi            # imm = 0xB71
callq 0x20740
leaq -0x1a25(%rip), %rdi     # 0x23e10
callq 0xed210
leaq -0xa51(%rip), %rdi      # 0x24df0
callq 0xed290
leaq -0x56d(%rip), %rdi      # 0x252e0
callq 0xed300
leaq -0x7f9(%rip), %rdi      # 0x25060
callq 0xed370
leaq -0x8a5(%rip), %rdi      # 0x24fc0
callq 0xed8a0
leaq -0xa31(%rip), %rdi      # 0x24e40
callq 0xed980
addq $0x18, %rsp
retq
nopl (%rax,%rax)