class_docstr: A class holding OpenGL machinery used by MeshRasterizerOpenGL.
class_docstr_tok: ["A","class","holding","OpenGL","machinery","used","by","MeshRasterizerOpenGL","."]
docstr: Initialize data specific to a GPU device: the EGL and CUDA contexts, the OpenGL
  program, as well as various buffer and array objects used to communicate with
  OpenGL.
  
  Args:
      device: A torch.device.
docstr_tok: ["Initialize","data","specific","to","a","GPU","device",":","the","EGL","and","CUDA","contexts",",","the","OpenGL","program",",","as","well","as","various","buffer","and","array","objects","used","to","communicate","with","OpenGL",".","Args",":","device",":","A","torch.device","."]
code: def initialize_device_data(self, device) -> None:
      """
      Initialize data specific to a GPU device: the EGL and CUDA contexts, the OpenGL
      program, as well as various buffer and array objects used to communicate with
      OpenGL.
  
      Args:
          device: A torch.device.
      """
      self.egl_context = global_device_context_store.get_egl_context(
          device
      )
      self.cuda_context = global_device_context_store.get_cuda_context(
          device
      )
  
      # self.program represents the OpenGL program we use for rasterization.
      if global_device_context_store.get_context_data(device) is None:
          with self.egl_context.active_and_locked():
              self.program = self._compile_and_link_gl_program()
              self._set_up_gl_program_properties(self.program)
  
              # Create objects used to transfer data into and out of the program.
              (
                  self.perspective_projection_uniform,
                  self.mesh_buffer_object,
                  self.vao,
                  self.fbo,
              ) = self._prepare_persistent_opengl_objects(
                  self.program,
                  self.max_faces,
              )
  
              # Register the input buffer with pycuda, to transfer data directly into it.
              self.cuda_context.push()
              self.cuda_buffer = pycuda.gl.RegisteredBuffer(
                  int(self.mesh_buffer_object),
                  pycuda.gl.graphics_map_flags.WRITE_DISCARD,
              )
              self.cuda_context.pop()
  
          global_device_context_store.set_context_data(
              device,
              (
                  self.program,
                  self.perspective_projection_uniform,
                  self.mesh_buffer_object,
                  self.vao,
                  self.fbo,
                  self.cuda_buffer,
              ),
          )
      (
          self.program,
          self.perspective_projection_uniform,
          self.mesh_buffer_object,
          self.vao,
          self.fbo,
          self.cuda_buffer,
      ) = global_device_context_store.get_context_data(device)
  
imports: import warnings
  from typing import Optional, Tuple, Union
  import numpy
  import OpenGL.GL
  import pycuda.gl
  import torch
  import torch.nn
  from pytorch3d.structures.meshes import Meshes
  from ..cameras import FoVOrthographicCameras, FoVPerspectiveCameras
  from ..mesh.rasterizer import Fragments, RasterizationSettings
  from ..utils import parse_image_size
  from .opengl_utils import _torch_to_opengl, global_device_context_store
label_desc: Use image node_id 3 for calling the _OpenGLMachinery obj's underlying member method code with example usage: obj.initialize_device_data(device) without return types