// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::UpdateOpenGL()
void RGBDImage::
UpdateOpenGL(void) 
{
  // Check identifier
  if (opengl_texture_id > 0) return;
  
  // Create identifier
  GLuint identifier;
  glGenTextures(1, &identifier);

  // Read color channels
  // ReadColorChannels();
  
  // Create temporary R2Image
  R2Image rgb_image(width, height, 3);
  for (int iy = 0; iy < height; iy++) {
    for (int ix = 0; ix < width; ix++) {
      rgb_image.SetPixelRGB(ix, iy, PixelColor(ix, iy));
    }
  }

  // Release color channels
  // ReleaseColorChannels();

  // Define texture
  glBindTexture(GL_TEXTURE_2D, identifier);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
  gluBuild2DMipmaps(GL_TEXTURE_2D, 3, rgb_image.Width(), rgb_image.Height(),
    GL_RGB, GL_UNSIGNED_BYTE, (const unsigned char *) rgb_image.Pixels());

  // Remember identifier
  opengl_texture_id = identifier;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
cmpl $0x0, 0x1c8(%rdi)
jg 0x1f5d1
movq %rdi, %rbx
pushq $0x1
popq %rdi
leaq 0xc(%rsp), %rsi
callq 0x11840
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
leaq 0x10(%rsp), %r14
pushq $0x3
popq %rcx
movq %r14, %rdi
callq 0x671d2
xorl %ebp, %ebp
leaq 0x28(%rsp), %r15
cmpl 0x2c(%rbx), %ebp
jge 0x1f521
xorl %r12d, %r12d
cmpl 0x28(%rbx), %r12d
jge 0x1f51d
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x1c31e
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
movq %r15, %rcx
callq 0x67560
incl %r12d
jmp 0x1f4f2
incl %ebp
jmp 0x1f4ea
movl 0xc(%rsp), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq 0x11750
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2802, %esi           # imm = 0x2802
movl $0x2900, %edx           # imm = 0x2900
callq 0x11820
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2803, %esi           # imm = 0x2803
movl $0x2900, %edx           # imm = 0x2900
callq 0x11820
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
movl $0x2703, %edx           # imm = 0x2703
callq 0x11820
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
movl $0x2601, %edx           # imm = 0x2601
callq 0x11820
movl $0x2300, %edi           # imm = 0x2300
movl $0x2200, %esi           # imm = 0x2200
movl $0x2100, %edx           # imm = 0x2100
callq 0x11670
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
pushq $0x3
popq %rsi
movl $0xde1, %edi            # imm = 0xDE1
movl $0x1907, %r8d           # imm = 0x1907
movl $0x1401, %r9d           # imm = 0x1401
callq 0x11350
movl 0xc(%rsp), %eax
movl %eax, 0x1c8(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x67414
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f5e0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x67414
movq %rbx, %rdi
callq 0x11a80
nop