roglew 0.2.3 → 0.2.4
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.
- data/lib/roglew/contexts/base.rb +1 -1
 - data/lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer.rb +4 -4
 - data/lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb +4 -4
 - data/lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb +4 -4
 - data/lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer.rb +4 -4
 - data/lib/roglew/extensions/GL_EXT_framebuffer_object/renderbuffer.rb +4 -4
 - data/lib/roglew/extensions/GL_VERSION_1_5/buffer.rb +4 -4
 - data/lib/roglew/extensions/GL_VERSION_1_5/buffer_context.rb +6 -2
 - data/lib/roglew/extensions/GL_VERSION_1_5/query.rb +4 -4
 - data/lib/roglew/extensions/GL_VERSION_1_5.rb +18 -4
 - data/lib/roglew/extensions/GL_VERSION_2_0/shader.rb +5 -4
 - data/lib/roglew/extensions/GL_VERSION_2_0/shader_program.rb +33 -5
 - data/lib/roglew/texture2d.rb +2 -2
 - data/lib/roglew/texture_context.rb +10 -4
 - data/lib/roglew.rb +1 -1
 - metadata +16 -8
 
    
        data/lib/roglew/contexts/base.rb
    CHANGED
    
    | 
         @@ -20,7 +20,7 @@ module Roglew 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  singleton_class.send(:include, @deferred ? DeferredContext : ImmediateContext)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  mod = self.class.instance_variable_get(@deferred ? :@deferred_mod : :@immediate_mod)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  singleton_class.send(:include, mod) if mod
         
     | 
| 
       23 
     | 
    
         
            -
                  run(&block) if  
     | 
| 
      
 23 
     | 
    
         
            +
                  run(&block) if respond_to?(:run, true)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                def self.included(c)
         
     | 
| 
         @@ -7,14 +7,14 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.gen_framebuffers
         
     | 
| 
       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 framebuffer #{id}"
         
     | 
| 
       16 
16 
     | 
    
         
             
                    ctx.delete_framebuffers(id)
         
     | 
| 
       17 
     | 
    
         
            -
                  end 
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                #target: one of GL::DRAW_FRAMEBUFFER, GL::READ_FRAMEBUFFER or GL::FRAMEBUFFER
         
     | 
| 
         @@ -7,14 +7,14 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.gen_renderbuffers
         
     | 
| 
       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 renderbuffer #{id}"
         
     | 
| 
       16 
16 
     | 
    
         
             
                    ctx.delete_renderbuffers(id)
         
     | 
| 
       17 
     | 
    
         
            -
                  end 
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def bind(deferred = nil, &block)
         
     | 
| 
         @@ -6,14 +6,14 @@ module Roglew 
     | 
|
| 
       6 
6 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  @context = context
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @id = context.gen_vertex_arrays
         
     | 
| 
       9 
     | 
    
         
            -
                  self.class.finalize( 
     | 
| 
      
 9 
     | 
    
         
            +
                  ObjectSpace.define_finalizer(self, self.class.finalize(@context, @id))
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                def self.finalize( 
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
      
 12 
     | 
    
         
            +
                def self.finalize(ctx, id)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  proc do
         
     | 
| 
       14 
14 
     | 
    
         
             
                    puts "releasing vertex array #{id}"
         
     | 
| 
       15 
15 
     | 
    
         
             
                    ctx.delete_vertex_arrays(id)
         
     | 
| 
       16 
     | 
    
         
            -
                  end 
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                def bind
         
     | 
| 
         @@ -7,14 +7,14 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.gen_framebuffersEXT
         
     | 
| 
       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 framebuffer #{id}"
         
     | 
| 
       16 
16 
     | 
    
         
             
                    ctx.delete_framebuffersEXT(id)
         
     | 
| 
       17 
     | 
    
         
            -
                  end 
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                #target: one of GL::DRAW_FRAMEBUFFER_EXT, GL::READ_FRAMEBUFFER_EXT or GL::FRAMEBUFFER_EXT
         
     | 
| 
         @@ -7,14 +7,14 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.gen_renderbuffersEXT
         
     | 
| 
       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 renderbuffer #{id}"
         
     | 
| 
       16 
16 
     | 
    
         
             
                    ctx.delete_renderbuffersEXT(id)
         
     | 
| 
       17 
     | 
    
         
            -
                  end 
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                def bind(deferred = nil, &block)
         
     | 
| 
         @@ -8,14 +8,14 @@ module Roglew 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.gen_buffers
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  self.class.finalize( 
     | 
| 
      
 11 
     | 
    
         
            +
                  ObjectSpace.define_finalizer(self, self.class.finalize(@context, @id))
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                def self.finalize( 
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
      
 14 
     | 
    
         
            +
                def self.finalize(ctx, id)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  proc do
         
     | 
| 
       16 
16 
     | 
    
         
             
                    puts "releasing buffer #{id}"
         
     | 
| 
       17 
17 
     | 
    
         
             
                    ctx.delete_buffers(id)
         
     | 
| 
       18 
     | 
    
         
            -
                  end 
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                def bind(target, deferred = nil, &block)
         
     | 
| 
         @@ -7,8 +7,12 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                  super(buffer, deferred, &block)
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                def data(usage,  
     | 
| 
       11 
     | 
    
         
            -
                  make_call(:buffer_data, @target, usage,  
     | 
| 
      
 10 
     | 
    
         
            +
                def data(usage, buffer = nil, type = nil)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  make_call(:buffer_data, @target, usage, buffer, type)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def sub_data(offset, type, buffer)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  make_call(:buffer_sub_data, @target, offset, type, buffer)
         
     | 
| 
       12 
16 
     | 
    
         
             
                end
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
       14 
18 
     | 
    
         
             
                private
         
     | 
| 
         @@ -6,14 +6,14 @@ module Roglew 
     | 
|
| 
       6 
6 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  @context = context
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @id = context.gen_queries
         
     | 
| 
       9 
     | 
    
         
            -
                  self.class.finalize( 
     | 
| 
      
 9 
     | 
    
         
            +
                  ObjectSpace.define_finalizer(self, self.class.finalize(@context, @id))
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                def self.finalize( 
     | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
      
 12 
     | 
    
         
            +
                def self.finalize(ctx, id)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  proc do
         
     | 
| 
       14 
14 
     | 
    
         
             
                    puts "releasing query #{id}"
         
     | 
| 
       15 
15 
     | 
    
         
             
                    ctx.delete_queries(id)
         
     | 
| 
       16 
     | 
    
         
            -
                  end 
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         
             
            end
         
     | 
| 
         @@ -87,15 +87,29 @@ module GL_VERSION_1_5 
     | 
|
| 
       87 
87 
     | 
    
         
             
                def_object :Buffers
         
     | 
| 
       88 
88 
     | 
    
         
             
                def_object :Queries
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                def buffer_data(target, usage,  
     | 
| 
       91 
     | 
    
         
            -
                  glBufferData(target, *if buffer && buffer.size > 0
         
     | 
| 
      
 90 
     | 
    
         
            +
                def buffer_data(target, usage, buffer = nil, type = nil)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  glBufferData(target, *if buffer.is_a?(Array) && buffer.size > 0
         
     | 
| 
       92 
92 
     | 
    
         
             
                    p = FFI::MemoryPointer.new(type, buffer.size)
         
     | 
| 
       93 
     | 
    
         
            -
                    p. 
     | 
| 
      
 93 
     | 
    
         
            +
                    p.send("write_array_of_#{type}", buffer)
         
     | 
| 
       94 
94 
     | 
    
         
             
                    [p.size, p]
         
     | 
| 
       95 
95 
     | 
    
         
             
                  else
         
     | 
| 
       96 
     | 
    
         
            -
                     
     | 
| 
      
 96 
     | 
    
         
            +
                    size = buffer.respond_to?(:to_i) ? buffer.to_i : 0
         
     | 
| 
      
 97 
     | 
    
         
            +
                    size *= if size > 0 && type
         
     | 
| 
      
 98 
     | 
    
         
            +
                      type = FFI.find_type(type) if type.is_a?(Symbol)
         
     | 
| 
      
 99 
     | 
    
         
            +
                      type.size
         
     | 
| 
      
 100 
     | 
    
         
            +
                    else
         
     | 
| 
      
 101 
     | 
    
         
            +
                      1
         
     | 
| 
      
 102 
     | 
    
         
            +
                    end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                    [size, nil]
         
     | 
| 
       97 
105 
     | 
    
         
             
                  end, usage)
         
     | 
| 
       98 
106 
     | 
    
         
             
                end
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                def buffer_sub_data(target, offset, type, buffer)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  pointer = FFI::MemoryPointer.new(type, buffer.size)
         
     | 
| 
      
 110 
     | 
    
         
            +
                  pointer.send("write_array_of_#{type}", buffer)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  glBufferSubData(target, offset, buffer.size, pointer)
         
     | 
| 
      
 112 
     | 
    
         
            +
                end
         
     | 
| 
       99 
113 
     | 
    
         
             
              end
         
     | 
| 
       100 
114 
     | 
    
         
             
            end
         
     | 
| 
       101 
115 
     | 
    
         | 
| 
         @@ -13,13 +13,14 @@ module Roglew 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    compile(src)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                  self.class.finalize( 
     | 
| 
      
 16 
     | 
    
         
            +
                  ObjectSpace.define_finalizer(self, self.class.finalize(@id, @context))
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                def self.finalize( 
     | 
| 
       20 
     | 
    
         
            -
                   
     | 
| 
      
 19 
     | 
    
         
            +
                def self.finalize(id, ctx)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  proc do
         
     | 
| 
      
 21 
     | 
    
         
            +
                    puts "releasing shader #{id}"
         
     | 
| 
       21 
22 
     | 
    
         
             
                    ctx.glDeleteShader(id)
         
     | 
| 
       22 
     | 
    
         
            -
                  end 
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
       23 
24 
     | 
    
         
             
                end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
26 
     | 
    
         
             
                def compile(src)
         
     | 
| 
         @@ -7,14 +7,16 @@ module Roglew 
     | 
|
| 
       7 
7 
     | 
    
         
             
                def initialize(context)
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @context = context
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @id = context.glCreateProgram()
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @attribs, @uniforms = {}, {}
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  self.class.finalize( 
     | 
| 
      
 12 
     | 
    
         
            +
                  ObjectSpace.define_finalizer(self, self.class.finalize(@id, @context))
         
     | 
| 
       12 
13 
     | 
    
         
             
                end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                def self.finalize( 
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
      
 15 
     | 
    
         
            +
                def self.finalize(id, ctx)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  proc do
         
     | 
| 
      
 17 
     | 
    
         
            +
                    puts "releasing program #{id}"
         
     | 
| 
       16 
18 
     | 
    
         
             
                    ctx.glDeleteProgram(id)
         
     | 
| 
       17 
     | 
    
         
            -
                  end 
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
       18 
20 
     | 
    
         
             
                end
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                def attach(*shaders)
         
     | 
| 
         @@ -34,10 +36,36 @@ module Roglew 
     | 
|
| 
       34 
36 
     | 
    
         | 
| 
       35 
37 
     | 
    
         
             
                def use_program
         
     | 
| 
       36 
38 
     | 
    
         
             
                  @context.glUseProgram(@id)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  if block_given?
         
     | 
| 
      
 40 
     | 
    
         
            +
                    yield
         
     | 
| 
      
 41 
     | 
    
         
            +
                    @context.glUseProgram(0)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                def attrib_location(name)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  name = name.to_sym
         
     | 
| 
      
 47 
     | 
    
         
            +
                  loc = @attribs[name]
         
     | 
| 
      
 48 
     | 
    
         
            +
                  return loc if loc
         
     | 
| 
      
 49 
     | 
    
         
            +
                  loc = @context.glGetAttribLocation(@id, name.to_s)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  return nil if loc < 0
         
     | 
| 
      
 51 
     | 
    
         
            +
                  @attribs[name] = loc
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                def attrib_locations(*names)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  names.map { |name| attrib_location(name) }
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                def uniform_location(name)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  name = name.to_sym
         
     | 
| 
      
 60 
     | 
    
         
            +
                  loc = @uniforms[name]
         
     | 
| 
      
 61 
     | 
    
         
            +
                  return loc if loc
         
     | 
| 
      
 62 
     | 
    
         
            +
                  loc = @context.glGetUniformLocation(@id, name.to_s)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  return nil if loc < 0
         
     | 
| 
      
 64 
     | 
    
         
            +
                  @uniforms[name] = loc
         
     | 
| 
       37 
65 
     | 
    
         
             
                end
         
     | 
| 
       38 
66 
     | 
    
         | 
| 
       39 
67 
     | 
    
         
             
                def uniform_locations(*names)
         
     | 
| 
       40 
     | 
    
         
            -
                  names.map { |name|  
     | 
| 
      
 68 
     | 
    
         
            +
                  names.map { |name| uniform_location(name) }
         
     | 
| 
       41 
69 
     | 
    
         
             
                end
         
     | 
| 
       42 
70 
     | 
    
         | 
| 
       43 
71 
     | 
    
         
             
                alias_method :link, :link_program
         
     | 
    
        data/lib/roglew/texture2d.rb
    CHANGED
    
    
| 
         @@ -2,8 +2,10 @@ module Roglew 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class TextureContext
         
     | 
| 
       3 
3 
     | 
    
         
             
                include Roglew::BaseContext(:texture)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :level
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(texture, deferred, target, level, &block)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @target, @level = target, level
         
     | 
| 
       7 
9 
     | 
    
         
             
                  super(texture, deferred, &block)
         
     | 
| 
       8 
10 
     | 
    
         
             
                end
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
         @@ -30,8 +32,12 @@ module Roglew 
     | 
|
| 
       30 
32 
     | 
    
         
             
                  make_call(:tex_parameter, @target, GL::TEXTURE_BORDER_COLOR, r, g, b, a)
         
     | 
| 
       31 
33 
     | 
    
         
             
                end
         
     | 
| 
       32 
34 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                def tex_image_2d(width, height, internalFormat, format, type, data)
         
     | 
| 
       34 
     | 
    
         
            -
                  make_call(:glTexImage2D, @target,  
     | 
| 
      
 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)
         
     | 
| 
       35 
41 
     | 
    
         
             
                end
         
     | 
| 
       36 
42 
     | 
    
         | 
| 
       37 
43 
     | 
    
         
             
                private
         
     | 
    
        data/lib/roglew.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: roglew
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.4
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2012-12- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2012-12-28 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: facets
         
     | 
| 
         @@ -607,12 +607,20 @@ files: 
     | 
|
| 
       607 
607 
     | 
    
         
             
            - README.md
         
     | 
| 
       608 
608 
     | 
    
         
             
            homepage: https://github.com/SilverPhoenix99/roglew
         
     | 
| 
       609 
609 
     | 
    
         
             
            licenses: []
         
     | 
| 
       610 
     | 
    
         
            -
            post_install_message: ! " 
     | 
| 
       611 
     | 
    
         
            -
              for choosing Roglew.\n\n   
     | 
| 
       612 
     | 
    
         
            -
              Changes:\n    -  
     | 
| 
       613 
     | 
    
         
            -
              \  
     | 
| 
       614 
     | 
    
         
            -
               
     | 
| 
       615 
     | 
    
         
            -
               
     | 
| 
      
 610 
     | 
    
         
            +
            post_install_message: ! "+----------------------------------------------------------------------------+\n
         
     | 
| 
      
 611 
     | 
    
         
            +
              \ Thanks for choosing Roglew.\n\n  ==========================================================================\n
         
     | 
| 
      
 612 
     | 
    
         
            +
              \ 0.2.4 Changes:\n    - Corrected a bug where contexts weren't calling the run method.\n
         
     | 
| 
      
 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
         
     | 
| 
      
 622 
     | 
    
         
            +
              \ If you like what you see, support us on Pledgie:\n    http://www.pledgie.com/campaigns/18830\n\n
         
     | 
| 
      
 623 
     | 
    
         
            +
              \ If you find any bugs, please report them on\n    https://github.com/SilverPhoenix99/roglew/issues\n\n+----------------------------------------------------------------------------+\n"
         
     | 
| 
       616 
624 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       617 
625 
     | 
    
         
             
            require_paths:
         
     | 
| 
       618 
626 
     | 
    
         
             
            - lib
         
     |