opengl-core 1.3.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +0,0 @@
1
- require 'fiddle'
2
- require 'opengl-core/opengl_stub'
3
-
4
- module Gl ; end
5
-
6
- # @api private
7
- module Gl::GlSym
8
-
9
- # Filled by gl_commands.rb
10
- GL_COMMAND_TYPES = {}
11
- # Filled by __load_gl_sym__
12
- GL_COMMAND_FUNCTIONS = {}
13
-
14
- # OpenGL library handle.
15
- @@opengl_lib = nil
16
-
17
- # Loads a symbol from the GL library. If the GL library hasn't yet been loaded
18
- # it will also do that. The returned function will be a wrapped Fiddle
19
- # function using the types that function name is associated with in
20
- # GL_COMMAND_TYPES. The returned value is cached in GL_COMMAND_FUNCTIONS and
21
- # returned if __load_gl_sym__ is called for the same name again.
22
- def self.__load_gl_sym__(name)
23
- if @@opengl_lib.nil?
24
- lib_path = case
25
- when apple?
26
- '/System/Library/Frameworks/OpenGL.framework/OpenGL'
27
- when windows? || Fiddle::WINDOWS
28
- 'opengl32.dll'
29
- when unix? || linux?
30
- 'libGL.so.1'
31
- else
32
- raise 'Unrecognized platform'
33
- end
34
- @@opengl_lib = Fiddle.dlopen(lib_path)
35
- end
36
-
37
- fn = GL_COMMAND_FUNCTIONS[name]
38
- if fn.nil?
39
- fn = (GL_COMMAND_FUNCTIONS[name] = begin
40
- sym = @@opengl_lib[name.to_s]
41
- types = GL_COMMAND_TYPES[name]
42
- Fiddle::Function.new(sym, types[:parameter_types], types[:return_type])
43
- rescue
44
- false
45
- end)
46
- end
47
-
48
- fn
49
- end
50
-
51
- end # module GlSym