Class: OpenGLLib::Linux

Inherits:
Object
  • Object
show all
Defined in:
lib/mittsu/renderers/opengl/opengl_lib.rb

Instance Method Summary collapse

Instance Method Details

#fileObject



40
41
42
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 40

def file
  'libGL.so'
end

#pathObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mittsu/renderers/opengl/opengl_lib.rb', line 16

def path
  # http://www.pilotlogic.com/sitejoom/index.php/wiki?id=398<F37>
  # 32              64
  # /usr/lib        /usr/lib64       redhat, mandriva
  # /usr/lib32      /usr/lib64       arch, gento
  # /usr/lib        /usr/lib64       slackware
  # /usr/lib/i386.. /usr/libx86_64/  debian
  libs = Dir.glob("/usr/lib*/**/libGL.so")
  if libs.size == 0
    puts "no libGL.so"
    exit 1
  end
  case kernel_module_in_use
  when /nvidia/
    return File.dirname(libs.grep(/nvidia/)[0])
  end
  # Get the same architecture that the runnning ruby
  if 1.size == 8 # 64 bits
    File.dirname(libs.grep(/64/)[0])
  else # 32 bits
    File.dirname(libs[0])
  end
end