roglew 0.2.4 → 0.2.6
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.
- checksums.yaml +15 -0
- data/README.md +35 -3
- data/lib/roglew/platform/windows/render_context.rb +1 -1
- data/lib/roglew/render_context.rb +4 -5
- data/lib/roglew/render_handle.rb +2 -0
- data/lib/roglew/texture.rb +24 -0
- data/lib/roglew/texture2d.rb +5 -5
- data/lib/roglew/texture2d_context.rb +52 -0
- data/lib/roglew/texture_context.rb +1 -44
- data/lib/roglew.rb +2 -2
- metadata +10 -22
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzI0NjU1NTAzNzA3NDQ2ZDJmOTc3MjYwY2IyNGZhOTM4MTQ3ZDdjYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmY1YTNkYzk0MGZmYzNhMmZjNDFhYTM3ZGE5ZGY0MjYyMDc5ZWUzNg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTQxN2ZiMmEyZjNlYzlkYzY1MDNjMzhmNzU5NzRkMzZlZDJlZThiNjAwYzdk
|
10
|
+
N2IxYjQ3YWU4NmQ0MWUwZDk2N2E2ZjhlM2JmOWE0ZjlhNmJhNjZmMTk3Y2Qx
|
11
|
+
Nzg1ZTc1NTg3OGJhOTM3MjQwZWJmNWFlOWEwZDg0NTFmYzIxYjA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MjE3NDVkMDEwZDBkMGJmYTRhYzZhM2U3ZjIzNmI4NGExYjgyNGNjN2U1NzM4
|
14
|
+
ZTU0NzkzY2UwNTZjN2M2Mzg0ZjUxZDIwYThkYWQzNTkxNTMxMTUzNDY3NTg1
|
15
|
+
N2RkZGRkNzdkOGNmMWNhNjkzMDQ0M2NkMzJiNmZhYzdiNDhlMDY=
|
data/README.md
CHANGED
@@ -1,6 +1,38 @@
|
|
1
|
-
roglew
|
2
|
-
|
1
|
+
# roglew
|
2
|
+
|
3
|
+
* https://github.com/SilverPhoenix99/roglew
|
4
|
+
|
5
|
+
## INSTALL:
|
6
|
+
|
7
|
+
gem install roglew
|
8
|
+
|
9
|
+
## DESCRIPTION:
|
3
10
|
|
4
11
|
Raw Glue - the Ruby OpenGL and Extensions Wrapper
|
5
12
|
|
6
|
-
<a href='http://www.pledgie.com/campaigns/18830'><img alt='Click here to lend your support to: roglew and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/18830.png?skin_name=chrome' border='0' /></a>
|
13
|
+
<a href='http://www.pledgie.com/campaigns/18830'><img alt='Click here to lend your support to: roglew and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/18830.png?skin_name=chrome' border='0' /></a>
|
14
|
+
|
15
|
+
## LICENSE:
|
16
|
+
|
17
|
+
(The MIT License)
|
18
|
+
|
19
|
+
Copyright (c) 2012 Pedro Pinto
|
20
|
+
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
22
|
+
a copy of this software and associated documentation files (the
|
23
|
+
'Software'), to deal in the Software without restriction, including
|
24
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
25
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
26
|
+
permit persons to whom the Software is furnished to do so, subject to
|
27
|
+
the following conditions:
|
28
|
+
|
29
|
+
The above copyright notice and this permission notice shall be
|
30
|
+
included in all copies or substantial portions of the Software.
|
31
|
+
|
32
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
33
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
34
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
35
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
36
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
37
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
38
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module Roglew
|
2
2
|
class RenderContext
|
3
|
-
include Roglew::Contextual(nil)
|
4
|
-
include GLObject
|
3
|
+
include GLObject, Roglew::Contextual(nil)
|
5
4
|
|
6
5
|
@registered_extensions = {}
|
7
6
|
|
8
|
-
def self.finalize(
|
9
|
-
|
7
|
+
def self.finalize(*args)
|
8
|
+
proc do
|
10
9
|
puts 'releasing a render context'
|
11
10
|
GL.platform_module.delete_context(*args)
|
12
|
-
end
|
11
|
+
end
|
13
12
|
end
|
14
13
|
|
15
14
|
def self.register_extensions(extensions)
|
data/lib/roglew/render_handle.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Roglew
|
2
|
+
class Texture
|
3
|
+
include Roglew::Contextual(TextureContext)
|
4
|
+
|
5
|
+
attr_reader :context, :id
|
6
|
+
|
7
|
+
def initialize(context)
|
8
|
+
@context = context
|
9
|
+
@id = context.gen_textures
|
10
|
+
self.class.finalize(self, @context, @id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.finalize(obj, ctx, id)
|
14
|
+
ObjectSpace.define_finalizer(obj, proc do
|
15
|
+
puts "releasing texture #{id}"
|
16
|
+
ctx.glDeleteTextures(id)
|
17
|
+
end)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bind(level = 0, deferred = nil, &block)
|
21
|
+
create_binding(deferred, GL::TEXTURE_2D, level, &block)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/roglew/texture2d.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module Roglew
|
2
2
|
class Texture2d
|
3
|
-
include Roglew::Contextual(
|
3
|
+
include Roglew::Contextual(Texture2dContext)
|
4
4
|
|
5
5
|
attr_reader :context, :id
|
6
6
|
|
7
7
|
def initialize(context)
|
8
8
|
@context = context
|
9
9
|
@id = context.gen_textures
|
10
|
-
self.class.finalize(
|
10
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@context, @id))
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.finalize(
|
14
|
-
|
13
|
+
def self.finalize(ctx, id)
|
14
|
+
proc do
|
15
15
|
puts "releasing texture #{id}"
|
16
16
|
ctx.glDeleteTextures(id)
|
17
|
-
end
|
17
|
+
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def bind(level = 0, deferred = nil, &block)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Roglew
|
2
|
+
class Texture2dContext
|
3
|
+
include Roglew::BaseContext(:texture)
|
4
|
+
|
5
|
+
attr_accessor :level
|
6
|
+
|
7
|
+
def initialize(texture, deferred, target, level, &block)
|
8
|
+
@target, @level = target, level
|
9
|
+
super(texture, deferred, &block)
|
10
|
+
end
|
11
|
+
|
12
|
+
{
|
13
|
+
:min_filter => :TEXTURE_MIN_FILTER,
|
14
|
+
:mag_filter => :TEXTURE_MAG_FILTER,
|
15
|
+
:min_lod => :TEXTURE_MIN_LOD,
|
16
|
+
:max_lod => :TEXTURE_MAX_LOD,
|
17
|
+
:base_level => :TEXTURE_BASE_LEVEL,
|
18
|
+
:max_level => :TEXTURE_MAX_LEVEL,
|
19
|
+
:wrap_s => :TEXTURE_WRAP_S,
|
20
|
+
:wrap_t => :TEXTURE_WRAP_T,
|
21
|
+
:wrap_r => :TEXTURE_WRAP_R,
|
22
|
+
:priority => :TEXTURE_PRIORITY,
|
23
|
+
:compare_mode => :TEXTURE_COMPARE_MODE,
|
24
|
+
:compare_func => :TEXTURE_COMPARE_FUNC,
|
25
|
+
:depth_mode => :DEPTH_TEXTURE_MODE,
|
26
|
+
:mipmap => :GENERATE_MIPMAP
|
27
|
+
}.each do |name, cnst|
|
28
|
+
class_eval "def #{name}=(v) make_call(:tex_parameter, @target, GL::#{cnst}, v) end"
|
29
|
+
end
|
30
|
+
|
31
|
+
def border_color(r, g, b, a)
|
32
|
+
make_call(:tex_parameter, @target, GL::TEXTURE_BORDER_COLOR, r, g, b, a)
|
33
|
+
end
|
34
|
+
|
35
|
+
def tex_image_2d(width, height, internalFormat, format, type, data = nil)
|
36
|
+
make_call(:glTexImage2D, @target, @level, internalFormat, width, height, 0, format, type, data)
|
37
|
+
end
|
38
|
+
|
39
|
+
def tex_subimage_2d(x, y, width, height, format, type, data = nil)
|
40
|
+
make_call(:glTexSubImage2D, @target, @level, x, y, width, height, format, type, data)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def bind
|
45
|
+
context.glBindTexture(@target, texture.id)
|
46
|
+
end
|
47
|
+
|
48
|
+
def unbind
|
49
|
+
context.glBindTexture(@target, 0)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -2,51 +2,8 @@ module Roglew
|
|
2
2
|
class TextureContext
|
3
3
|
include Roglew::BaseContext(:texture)
|
4
4
|
|
5
|
-
attr_accessor :level
|
5
|
+
attr_accessor :target, :level
|
6
6
|
|
7
|
-
def initialize(texture, deferred, target, level, &block)
|
8
|
-
@target, @level = target, level
|
9
|
-
super(texture, deferred, &block)
|
10
|
-
end
|
11
7
|
|
12
|
-
{
|
13
|
-
:min_filter => :TEXTURE_MIN_FILTER,
|
14
|
-
:mag_filter => :TEXTURE_MAG_FILTER,
|
15
|
-
:min_lod => :TEXTURE_MIN_LOD,
|
16
|
-
:max_lod => :TEXTURE_MAX_LOD,
|
17
|
-
:base_level => :TEXTURE_BASE_LEVEL,
|
18
|
-
:max_level => :TEXTURE_MAX_LEVEL,
|
19
|
-
:wrap_s => :TEXTURE_WRAP_S,
|
20
|
-
:wrap_t => :TEXTURE_WRAP_T,
|
21
|
-
:wrap_r => :TEXTURE_WRAP_R,
|
22
|
-
:priority => :TEXTURE_PRIORITY,
|
23
|
-
:compare_mode => :TEXTURE_COMPARE_MODE,
|
24
|
-
:compare_func => :TEXTURE_COMPARE_FUNC,
|
25
|
-
:depth_mode => :DEPTH_TEXTURE_MODE,
|
26
|
-
:mipmap => :GENERATE_MIPMAP
|
27
|
-
}.each do |name, cnst|
|
28
|
-
class_eval "def #{name}=(v) make_call(:tex_parameter, @target, GL::#{cnst}, v) end"
|
29
|
-
end
|
30
|
-
|
31
|
-
def border_color(r, g, b, a)
|
32
|
-
make_call(:tex_parameter, @target, GL::TEXTURE_BORDER_COLOR, r, g, b, a)
|
33
|
-
end
|
34
|
-
|
35
|
-
def tex_image_2d(width, height, internalFormat, format, type, data = nil)
|
36
|
-
make_call(:glTexImage2D, @target, @level, internalFormat, width, height, 0, format, type, data)
|
37
|
-
end
|
38
|
-
|
39
|
-
def tex_subimage_2d(x, y, width, height, format, type, data = nil)
|
40
|
-
make_call(:glTexSubImage2D, @target, @level, x, y, width, height, format, type, data)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def bind
|
45
|
-
context.glBindTexture(@target, texture.id)
|
46
|
-
end
|
47
|
-
|
48
|
-
def unbind
|
49
|
-
context.glBindTexture(@target, 0)
|
50
|
-
end
|
51
8
|
end
|
52
9
|
end
|
data/lib/roglew.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
'.each { |f| require f }
|
11
11
|
|
12
12
|
module Roglew
|
13
|
-
VERSION = '0.2.
|
13
|
+
VERSION = '0.2.6'.freeze
|
14
14
|
|
15
15
|
PLATFORM = case
|
16
16
|
when Platform.local.windows? then 'windows'
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
platform/#{Roglew::PLATFORM}/gl
|
32
32
|
gl
|
33
33
|
platform/#{Roglew::PLATFORM}
|
34
|
-
|
34
|
+
texture2d_context
|
35
35
|
texture2d
|
36
36
|
render_context
|
37
37
|
'.each { |f| require "roglew/#{f}" }
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roglew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- SilverPhoenix99
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: facets
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,7 +28,6 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: ffi
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
@@ -39,7 +35,6 @@ dependencies:
|
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
@@ -601,46 +596,39 @@ files:
|
|
601
596
|
- lib/roglew/platform/windows.rb
|
602
597
|
- lib/roglew/render_context.rb
|
603
598
|
- lib/roglew/render_handle.rb
|
599
|
+
- lib/roglew/texture.rb
|
604
600
|
- lib/roglew/texture2d.rb
|
601
|
+
- lib/roglew/texture2d_context.rb
|
605
602
|
- lib/roglew/texture_context.rb
|
606
603
|
- lib/roglew.rb
|
607
604
|
- README.md
|
608
605
|
homepage: https://github.com/SilverPhoenix99/roglew
|
609
|
-
licenses:
|
606
|
+
licenses:
|
607
|
+
- MIT
|
608
|
+
metadata: {}
|
610
609
|
post_install_message: ! "+----------------------------------------------------------------------------+\n
|
611
610
|
\ Thanks for choosing Roglew.\n\n ==========================================================================\n
|
612
|
-
\ 0.2.
|
613
|
-
\ - Corrected the calls to ObjectSpace::define_finalizer.\n - Changed RenderContext#buffer_data
|
614
|
-
method to accept ffi instance types\n (e.g., Struct) as a parameter and calculates
|
615
|
-
the size automatically.\n - ShaderProgram#use_program can act as a bind method.\n
|
616
|
-
\ - Optional level parameter for Texture2d#bind.\n - Data parameter is now
|
617
|
-
optional for TextureContext#tex_image_2d.\n - The level can now be changed in
|
618
|
-
TextureContext at any point.\n - Added the methods:\n RenderContext#buffer_sub_data\n
|
619
|
-
\ BufferContext#sub_data methods\n ShaderProgram#attrib_location\n
|
620
|
-
\ ShaderProgram#attrib_locations\n ShaderProgram#uniform_location\n
|
621
|
-
\ TextureContext#tex_subimage_2d\n ==========================================================================\n\n
|
611
|
+
\ 0.2.6 Changes:\n - Fixed a few finalizers.\n ==========================================================================\n\n
|
622
612
|
\ If you like what you see, support us on Pledgie:\n http://www.pledgie.com/campaigns/18830\n\n
|
623
613
|
\ If you find any bugs, please report them on\n https://github.com/SilverPhoenix99/roglew/issues\n\n+----------------------------------------------------------------------------+\n"
|
624
614
|
rdoc_options: []
|
625
615
|
require_paths:
|
626
616
|
- lib
|
627
617
|
required_ruby_version: !ruby/object:Gem::Requirement
|
628
|
-
none: false
|
629
618
|
requirements:
|
630
619
|
- - ! '>='
|
631
620
|
- !ruby/object:Gem::Version
|
632
621
|
version: '0'
|
633
622
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
634
|
-
none: false
|
635
623
|
requirements:
|
636
624
|
- - ! '>='
|
637
625
|
- !ruby/object:Gem::Version
|
638
626
|
version: '0'
|
639
627
|
requirements: []
|
640
628
|
rubyforge_project:
|
641
|
-
rubygems_version:
|
629
|
+
rubygems_version: 2.0.3
|
642
630
|
signing_key:
|
643
|
-
specification_version:
|
631
|
+
specification_version: 4
|
644
632
|
summary: Ruby OpenGL and Extensions Wrapper
|
645
633
|
test_files: []
|
646
634
|
has_rdoc:
|