// File: /workspace/github_cpp_makefile_star2_O1/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 0x2115b
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
movl $0x1, %edi
callq 0x11840
movl 0x28(%rbx), %esi
movl 0x2c(%rbx), %edx
leaq 0x10(%rsp), %rdi
movl $0x3, %ecx
callq 0x70afe
cmpl $0x0, 0x2c(%rbx)
jle 0x210a9
xorl %ebp, %ebp
leaq 0x28(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpl $0x0, 0x28(%rbx)
jle 0x210a2
xorl %r12d, %r12d
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x1d9d8
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
movq %r14, %rcx
callq 0x70eae
incl %r12d
cmpl 0x28(%rbx), %r12d
jl 0x21079
incl %ebp
cmpl 0x2c(%rbx), %ebp
jl 0x21070
movl 0xc(%rsp), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq 0x11760
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 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 0x70d66
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2116a
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x70d66
movq %rbx, %rdi
callq 0x11a70
nop