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,4 +1,14 @@
1
- module Gl
1
+ # This file is part of the opengl-core project.
2
+ # <https://github.com/nilium/ruby-opengl>
3
+ #
4
+ # -----------------------------------------------------------------------------
5
+ #
6
+ # gl-enums.rb
7
+ # File containing GL enumerators.
8
+ # This file is generated by gen_from_xml.rb, do not modify it.
9
+
10
+
11
+ module GL
2
12
  # @api raw
3
13
  GL_DEPTH_BUFFER_BIT = 0x00000100
4
14
  # @api raw
@@ -24,8 +34,6 @@ module Gl
24
34
  # @api raw
25
35
  GL_TRIANGLE_FAN = 0x0006
26
36
  # @api raw
27
- GL_QUADS = 0x0007
28
- # @api raw
29
37
  GL_NEVER = 0x0200
30
38
  # @api raw
31
39
  GL_LESS = 0x0201
@@ -616,6 +624,24 @@ module Gl
616
624
  # @api raw
617
625
  GL_TEXTURE_COMPARE_FUNC = 0x884D
618
626
  # @api raw
627
+ GL_FUNC_ADD = 0x8006
628
+ # @api raw
629
+ GL_FUNC_SUBTRACT = 0x800A
630
+ # @api raw
631
+ GL_FUNC_REVERSE_SUBTRACT = 0x800B
632
+ # @api raw
633
+ GL_MIN = 0x8007
634
+ # @api raw
635
+ GL_MAX = 0x8008
636
+ # @api raw
637
+ GL_CONSTANT_COLOR = 0x8001
638
+ # @api raw
639
+ GL_ONE_MINUS_CONSTANT_COLOR = 0x8002
640
+ # @api raw
641
+ GL_CONSTANT_ALPHA = 0x8003
642
+ # @api raw
643
+ GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004
644
+ # @api raw
619
645
  GL_BUFFER_SIZE = 0x8764
620
646
  # @api raw
621
647
  GL_BUFFER_USAGE = 0x8765
@@ -1650,6 +1676,8 @@ module Gl
1650
1676
  # @api raw
1651
1677
  GL_ISOLINES = 0x8E7A
1652
1678
  # @api raw
1679
+ GL_QUADS = 0x0007
1680
+ # @api raw
1653
1681
  GL_FRACTIONAL_ODD = 0x8E7B
1654
1682
  # @api raw
1655
1683
  GL_FRACTIONAL_EVEN = 0x8E7C
@@ -1980,6 +2008,14 @@ module Gl
1980
2008
  # @api raw
1981
2009
  GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF
1982
2010
  # @api raw
2011
+ GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C
2012
+ # @api raw
2013
+ GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D
2014
+ # @api raw
2015
+ GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E
2016
+ # @api raw
2017
+ GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F
2018
+ # @api raw
1983
2019
  GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F
1984
2020
  # @api raw
1985
2021
  GL_NUM_SHADING_LANGUAGE_VERSIONS = 0x82E9
@@ -2030,13 +2066,13 @@ module Gl
2030
2066
  # @api raw
2031
2067
  GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266
2032
2068
  # @api raw
2033
- GL_MAX_COMPUTE_LOCAL_INVOCATIONS = 0x90EB
2069
+ GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB
2034
2070
  # @api raw
2035
2071
  GL_MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE
2036
2072
  # @api raw
2037
2073
  GL_MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF
2038
2074
  # @api raw
2039
- GL_COMPUTE_LOCAL_WORK_SIZE = 0x8267
2075
+ GL_COMPUTE_WORK_GROUP_SIZE = 0x8267
2040
2076
  # @api raw
2041
2077
  GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC
2042
2078
  # @api raw
@@ -2108,6 +2144,8 @@ module Gl
2108
2144
  # @api raw
2109
2145
  GL_PROGRAM = 0x82E2
2110
2146
  # @api raw
2147
+ GL_VERTEX_ARRAY = 0x8074
2148
+ # @api raw
2111
2149
  GL_QUERY = 0x82E3
2112
2150
  # @api raw
2113
2151
  GL_PROGRAM_PIPELINE = 0x82E4
@@ -2500,6 +2538,10 @@ module Gl
2500
2538
  # @api raw
2501
2539
  GL_MAX_VERTEX_ATTRIB_STRIDE = 0x82E5
2502
2540
  # @api raw
2541
+ GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 0x8221
2542
+ # @api raw
2543
+ GL_TEXTURE_BUFFER_BINDING = 0x8C2A
2544
+ # @api raw
2503
2545
  GL_MAP_PERSISTENT_BIT = 0x0040
2504
2546
  # @api raw
2505
2547
  GL_MAP_COHERENT_BIT = 0x0080
@@ -2563,4 +2605,4 @@ module Gl
2563
2605
  GL_PROGRAM_POINT_SIZE = GL_VERTEX_PROGRAM_POINT_SIZE
2564
2606
  # @api raw
2565
2607
  GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS
2566
- end # module Gl
2608
+ end # module GL
@@ -0,0 +1,74 @@
1
+ # This file is part of the opengl-core project.
2
+ # <https://github.com/nilium/ruby-opengl>
3
+ #
4
+ # -----------------------------------------------------------------------------
5
+ #
6
+ # gl_sym.rb
7
+ # GL symbol loader front-end.
8
+
9
+
10
+ module GL
11
+
12
+ # @api private
13
+ #
14
+ # Symbol loading is currently handled by Fiddle, though it's entirely possible
15
+ # for someone to swap out loaders they want.
16
+ #
17
+ # Loaders must provide two methods:
18
+ # - load_sym(name, types)
19
+ # name is the name of the GL symbol to load, types is a dictionary
20
+ # of keys return_type and parameter_types, the former being a symbol
21
+ # defining the return type of the function and parameter_types being an
22
+ # array of the parameter types received by the function.
23
+ #
24
+ # - unload()
25
+ # Called to unload any resources held by the loader in the event that the
26
+ # loader is swapped out at runtime.
27
+ #
28
+ module GLSym
29
+
30
+ # Filled by gl_commands.rb
31
+ GL_COMMAND_TYPES = {}
32
+
33
+ class << self
34
+
35
+ attr_accessor :loader
36
+ attr_accessor :__cached_functions__
37
+
38
+ alias_method :__loader__=, :loader=
39
+ def loader=(new_loader)
40
+ return if self.loader == new_loader
41
+ self.loader.unload if self.loader
42
+ self.__cached_functions__.clear if self.__cached_functions__
43
+ self.__loader__ = new_loader
44
+ end
45
+
46
+ # Loads the GL symbol with the given name. It's assumed that this symbol
47
+ # has its types defined in GL_COMMAND_TYPES.
48
+ def load_sym(name)
49
+ functions = (self.__cached_functions__ ||= {})
50
+ functions[name] ||= begin
51
+ symfunc = self.loader.load_sym(name, GL_COMMAND_TYPES[name])
52
+
53
+ if symfunc.nil?
54
+ raise NoMethodError, "GL function #{name} could not be loaded"
55
+ end
56
+
57
+ symfunc
58
+ end
59
+ end
60
+
61
+ end # singleton_class
62
+
63
+ end # GLSym
64
+
65
+ end # GL
66
+
67
+
68
+ begin
69
+ require 'opengl-core/gl-sym/fiddle-symbol-loader'
70
+
71
+ GL::GLSym.loader = GL::GLSym::FiddleSymbolLoader.new
72
+ rescue LoadError
73
+ warn "FiddleSymbolLoader could not be loaded - GLSym has no default loader"
74
+ end
@@ -0,0 +1,130 @@
1
+ # This file is part of the opengl-core project.
2
+ # <https://github.com/nilium/ruby-opengl>
3
+ #
4
+ # -----------------------------------------------------------------------------
5
+ #
6
+ # fiddle-symbol-loader.rb
7
+ # Fiddle-based GL symbol loader.
8
+
9
+
10
+ require 'fiddle'
11
+ require 'rbconfig'
12
+
13
+
14
+ module GL
15
+
16
+ module GLSym
17
+
18
+ class FiddleSymbolLoader
19
+
20
+ TYPE_MAPPINGS = {
21
+ :'void' => Fiddle::TYPE_VOID,
22
+ :'GLvoid' => Fiddle::TYPE_VOID,
23
+ :'GLenum' => Fiddle::TYPE_INT,
24
+ :'GLboolean' => Fiddle::TYPE_CHAR,
25
+ :'GLbitfield' => Fiddle::TYPE_INT,
26
+ :'GLbyte' => Fiddle::TYPE_CHAR,
27
+ :'GLshort' => Fiddle::TYPE_SHORT,
28
+ :'GLint' => Fiddle::TYPE_INT,
29
+ :'GLclampx' => Fiddle::TYPE_INT,
30
+ :'GLubyte' => Fiddle::TYPE_CHAR,
31
+ :'GLushort' => Fiddle::TYPE_SHORT,
32
+ :'GLuint' => Fiddle::TYPE_INT,
33
+ :'GLsizei' => Fiddle::TYPE_INT,
34
+ :'GLfloat' => Fiddle::TYPE_FLOAT,
35
+ :'GLclampf' => Fiddle::TYPE_FLOAT,
36
+ :'GLdouble' => Fiddle::TYPE_DOUBLE,
37
+ :'GLclampd' => Fiddle::TYPE_DOUBLE,
38
+ :'GLchar' => Fiddle::TYPE_CHAR,
39
+ :'GLcharARB' => Fiddle::TYPE_CHAR,
40
+ :'GLhandleARB' => Fiddle::TYPE_UINTPTR_T,
41
+ :'GLhalfARB' => Fiddle::TYPE_SHORT,
42
+ :'GLhalf' => Fiddle::TYPE_SHORT,
43
+ :'GLfixed' => Fiddle::TYPE_INT,
44
+ :'GLintptr' => Fiddle::TYPE_PTRDIFF_T,
45
+ :'GLsizeiptr' => Fiddle::TYPE_PTRDIFF_T,
46
+ :'GLint64' => Fiddle::TYPE_LONG_LONG,
47
+ :'GLuint64' => Fiddle::TYPE_LONG_LONG,
48
+ :'GLintptrARB' => Fiddle::TYPE_PTRDIFF_T,
49
+ :'GLsizeiptrARB' => Fiddle::TYPE_PTRDIFF_T,
50
+ :'GLint64EXT' => Fiddle::TYPE_LONG_LONG,
51
+ :'GLuint64EXT' => Fiddle::TYPE_LONG_LONG,
52
+ :'GLsync' => Fiddle::TYPE_VOIDP,
53
+ :'GLhalfNV' => Fiddle::TYPE_SHORT,
54
+ :'GLvdpauSurfaceNV' => Fiddle::TYPE_PTRDIFF_T,
55
+ :'GLDEBUGPROC' => Fiddle::TYPE_VOIDP,
56
+ :'GLDEBUGPROCARB' => Fiddle::TYPE_VOIDP,
57
+ :'GLDEBUGPROCKHR' => Fiddle::TYPE_VOIDP,
58
+ :'GLDEBUGPROCAMD' => Fiddle::TYPE_VOIDP,
59
+ }
60
+
61
+ TYPE_MAPPINGS.default_proc = -> (hash, key) do
62
+ if key.to_s.end_with?('*')
63
+ hash[key] = Fiddle::TYPE_VOIDP
64
+ else
65
+ raise ArgumentError, "No type mapping defined for #{key}"
66
+ end
67
+ end
68
+
69
+ def fiddle_typed(types)
70
+ case types
71
+ when Array then types.map { |i| fiddle_typed(i) }
72
+ else TYPE_MAPPINGS[types.to_sym]
73
+ end
74
+ end
75
+
76
+ def initialize
77
+ @opengl_lib = nil
78
+ @loaded = {}
79
+ end
80
+
81
+ def unload
82
+ if @opengl_lib
83
+ @opengl_lib.close
84
+ @opengl_lib = nil
85
+ end
86
+
87
+ @loaded.clear
88
+ end
89
+
90
+ # Loads a symbol from the GL library. If the GL library hasn't yet been loaded
91
+ # it will also do that. The returned function will be a wrapped Fiddle
92
+ # function using the types that function name is associated with in
93
+ # GL_COMMAND_TYPES. The returned value is cached in GL_COMMAND_FUNCTIONS and
94
+ # returned if load_sym is called for the same name again.
95
+ def load_sym(name, types)
96
+ if @opengl_lib.nil?
97
+ host = RbConfig::CONFIG['host_os']
98
+ lib_path =
99
+ case host
100
+ when %r[ mac\sos | darwin ]ix
101
+ '/System/Library/Frameworks/OpenGL.framework/OpenGL'
102
+ when %r[ mswin | msys | mingw | cygwin | bcwin | wince | emc ]ix
103
+ 'opengl32.dll'
104
+ when %r[ linux | solaris | bsd]ix
105
+ 'libGL.so.1'
106
+ else
107
+ raise 'Unrecognized platform'
108
+ end
109
+
110
+ @opengl_lib = Fiddle.dlopen(lib_path)
111
+ end
112
+
113
+ begin
114
+ sym = @opengl_lib[name.to_s]
115
+
116
+ Fiddle::Function.new(
117
+ sym,
118
+ fiddle_typed(types[:parameter_types]),
119
+ fiddle_typed(types[:return_type])
120
+ )
121
+ rescue Fiddle::DLError
122
+ nil
123
+ end if @opengl_lib
124
+ end
125
+
126
+ end # FiddleSymbolLoader
127
+
128
+ end # GLSym
129
+
130
+ end # GL
metadata CHANGED
@@ -1,51 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opengl-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noel Raymond Cower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-12 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.6'
27
27
  description: OpenGL core profile (3.2 onward, no deprecated functionality) bindings
28
28
  for Ruby 2.x. Generated from Khronos XML spec files.
29
29
  email: ncower@gmail.com
30
30
  executables: []
31
- extensions:
32
- - ext/opengl-core/extconf.rb
31
+ extensions: []
33
32
  extra_rdoc_files: []
34
33
  files:
35
- - lib/opengl-core/aux/buffer.rb
36
- - lib/opengl-core/aux/gl.rb
37
- - lib/opengl-core/aux/marked.rb
38
- - lib/opengl-core/aux/program.rb
39
- - lib/opengl-core/aux/shader.rb
40
- - lib/opengl-core/aux/texture.rb
41
- - lib/opengl-core/aux/vertex_array.rb
42
- - lib/opengl-core/aux.rb
43
- - lib/opengl-core/gl_commands.rb
44
- - lib/opengl-core/gl_enums.rb
45
- - lib/opengl-core/gl_sym.rb
34
+ - COPYING
35
+ - README.md
46
36
  - lib/opengl-core.rb
47
- - ext/opengl-core/opengl_stub.c
48
- - ext/opengl-core/extconf.rb
37
+ - lib/opengl-core/gl-commands.rb
38
+ - lib/opengl-core/gl-enums.rb
39
+ - lib/opengl-core/gl-sym.rb
40
+ - lib/opengl-core/gl-sym/fiddle-symbol-loader.rb
49
41
  homepage: https://github.com/nilium/ruby-opengl
50
42
  licenses:
51
43
  - Simplified BSD
@@ -56,17 +48,17 @@ require_paths:
56
48
  - lib
57
49
  required_ruby_version: !ruby/object:Gem::Requirement
58
50
  requirements:
59
- - - '>='
51
+ - - "~>"
60
52
  - !ruby/object:Gem::Version
61
- version: 2.0.0
53
+ version: '2'
62
54
  required_rubygems_version: !ruby/object:Gem::Requirement
63
55
  requirements:
64
- - - '>='
56
+ - - ">="
65
57
  - !ruby/object:Gem::Version
66
58
  version: '0'
67
59
  requirements: []
68
60
  rubyforge_project:
69
- rubygems_version: 2.0.5
61
+ rubygems_version: 2.2.1
70
62
  signing_key:
71
63
  specification_version: 4
72
64
  summary: OpenGL core profile bindings
@@ -1,3 +0,0 @@
1
- require 'mkmf'
2
-
3
- create_makefile('opengl-core/opengl_stub')
@@ -1,56 +0,0 @@
1
- #include "ruby.h"
2
-
3
-
4
- /* @api private */
5
- static VALUE plat_is_apple(VALUE self)
6
- {
7
- #if defined(__APPLE__)
8
- return Qtrue;
9
- #else
10
- return Qfalse;
11
- #endif
12
- }
13
-
14
-
15
- /* @api private */
16
- static VALUE plat_is_windows(VALUE self)
17
- {
18
- #if defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
19
- return Qtrue;
20
- #else
21
- return Qfalse;
22
- #endif
23
- }
24
-
25
-
26
- /* @api private */
27
- static VALUE plat_is_unix(VALUE self)
28
- {
29
- #if defined(__unix) || defined(__unix__) || defined(unix) || defined(__APPLE__)
30
- return Qtrue;
31
- #else
32
- return Qfalse;
33
- #endif
34
- }
35
-
36
-
37
- /* @api private */
38
- static VALUE plat_is_linux(VALUE self)
39
- {
40
- #if defined(__linux__) || defined(linux) || defined(__linux)
41
- return Qtrue;
42
- #else
43
- return Qfalse;
44
- #endif
45
- }
46
-
47
-
48
- void Init_opengl_stub(void)
49
- {
50
- VALUE gl_module = rb_define_module("Gl");
51
- VALUE gl_sym_module = rb_define_module_under(gl_module, "GlSym");
52
- rb_define_singleton_method(gl_sym_module, "apple?", plat_is_apple, 0);
53
- rb_define_singleton_method(gl_sym_module, "windows?", plat_is_windows, 0);
54
- rb_define_singleton_method(gl_sym_module, "unix?", plat_is_unix, 0);
55
- rb_define_singleton_method(gl_sym_module, "linux?", plat_is_linux, 0);
56
- }