// File: /workspace/github_cpp_makefile_star2_O3/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 0x20ecd
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
movl $0x1, %edi
callq 0x11830
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
leaq 0x10(%rsp), %rdi
movl $0x3, %ecx
callq 0x6fc8a
movl 0x2c(%rbx), %ecx
testl %ecx, %ecx
jle 0x20e1b
movl 0x28(%rbx), %eax
xorl %ebp, %ebp
leaq 0x28(%rsp), %r14
leaq 0x10(%rsp), %r15
testl %eax, %eax
jle 0x20e15
xorl %r12d, %r12d
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x1d72e
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x7003a
incl %r12d
movl 0x28(%rbx), %eax
cmpl %eax, %r12d
jl 0x20de7
movl 0x2c(%rbx), %ecx
incl %ebp
cmpl %ecx, %ebp
jl 0x20de0
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 0x11810
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2803, %esi           # imm = 0x2803
movl $0x2900, %edx           # imm = 0x2900
callq 0x11810
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
movl $0x2703, %edx           # imm = 0x2703
callq 0x11810
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
movl $0x2601, %edx           # imm = 0x2601
callq 0x11810
movl $0x2300, %edi           # imm = 0x2300
movl $0x2200, %esi           # imm = 0x2200
movl $0x2100, %edx           # imm = 0x2100
callq 0x11660
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl $0xde1, %edi            # imm = 0xDE1
movl $0x3, %esi
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 0x6fee4
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x20edc
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6fee4
movq %rbx, %rdi
callq 0x11a60
nop